[Vuejs]-Changing values of object with integers as keys not working

0👍

You cannot use an integer value as a key in an object. It will be converted to a string value. See this answer to a similar question.

As for accessing a value by a constant string key or by a key from a variable there si no difference.
Try this code:

var a = { 1: 'test1', 2: 'test2' }
var b = '1'
console.log(a['1']  === a[b])

Leave a comment