How do I access the Object.prototype method in the following logic?

前端 未结 4 579
一个人的身影
一个人的身影 2020-12-23 14:24

I am using the following logic to get the i18n string of the given key.

export function i18n(key) {
  if (entries.hasOwnProperty(key)) {
    return entries[k         


        
4条回答
  •  感情败类
    2020-12-23 14:49

    I hope I won't get downvoted for this, probably will, but !

    var a = {b: "I'm here"}
    if (a["b"]) { console.log(a["b"]) }
    if (a["c"]) { console.log("Never going to happen") }
    

    Has, insofar, never broken my code

提交回复
热议问题