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

前端 未结 4 585
一个人的身影
一个人的身影 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

    It seems like this would also work:

    key in entries

    since that will return a boolean on whether or not the key exists inside the object?

提交回复
热议问题