Multiple variable assignments in one row

前端 未结 4 424
逝去的感伤
逝去的感伤 2020-12-09 07:27

As each programming language is different and my experience with Javascript is on basic level, I would like to know, how multiple variable assignments in one row are evaluat

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-09 08:06

    You have only to try it to know the answer: Yes.

    The reason it works like that is that assignment takes whatever is on the right-hand side of the equals sign and assigns that value to the variable on the left-hand side.

    So 5 is assigned to d; then the value of d is assigned to c and so on.

提交回复
热议问题