javascript - Some problems with ternary operator
阿神
阿神 2017-07-05 10:44:02
0
3
764

阿神
阿神

闭关修行中......

reply all (3)
習慣沉默

See inside the black box, the value oflahere is 0. In the sentence you marked,la == 0 ? 1 : la - 1, the output value is indeed 1 (becausela == 0established), but there is no place in this line to assign a value tola, so the value oflawill not change and is still 0.

    ringa_lee
    la == 0 ? la = 1 : la - 1
      黄舟

      la==0?1:la-1

      This statement does nothing at all and needs to be changed to;

      la=la==0?1:la-1

        Latest Downloads
        More>
        Web Effects
        Website Source Code
        Website Materials
        Front End Template
        About us Disclaimer Sitemap
        php.cn:Public welfare online PHP training,Help PHP learners grow quickly!