-_-#【Better JS Code】插入迭代值

+function() {

    var i = 0

    var values = ['xiaoming', 'xiaohong']

    var name = values[i]

    i++

    console.log(name, i)

}();



// better

+function() {

    var i = 0

    var values = ['xiaoming', 'xiaohong']

    var name = values[i++]

    console.log(name, i)

}();

 

你可能感兴趣的:(code)