0, what does the '+' after '=' do?

This question already has an answer here:

  • What does = +_ mean in JavaScript 12 answers

  • Converts it into a number. It's the opposite of -fromIndex , so it has to convert into a number.

    See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators#-_.28Unary_Plus.29

    +"0" 
    >> 0
    +true 
    >> 1
    
    链接地址: http://www.djcxy.com/p/73930.html

    上一篇: Js对象键:加值语法

    下一篇: 0,'='之后的'+'做什么?