What does the colon ( : ) mean in this javascript line?

后端 未结 2 1411
长发绾君心
长发绾君心 2021-01-06 08:27

What does the \":\" mean in the 3-6th lines below?

function displayError(error) {
    var errorTypes = {
        0: \"Unknown error\",
        1: \"Permissi         


        
2条回答
  •  南方客
    南方客 (楼主)
    2021-01-06 08:39

    That's how you define key value pairs in an object. So errorTypes.2 would return the string "Position is not available".

提交回复
热议问题