Js attribute problem: although both obj.an and obj ['a'] obtain attribute values, there must be relative differences. I don't know what the difference is.

I"d like to find out what the differences are

.
Mar.23,2021

for example, I have a strange property name

var a = {
  'b-1': 2
}
a['b-1']  // 

for example, I need to get

dynamically.
var obj = {
    a: '1',
    b: '2'
}

function getValue(key) {
    return obj[key]  // 
} 

getValue('a')
getValue('b')


the standard universal method is actually in the form of a [] . The format of . is only used for individual string attributes (methods) of names determined in advance

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e60dc8-458fa.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e60dc8-458fa.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?