繁体   English   中英

为什么 console.log 部分的 b 与 c 相同? B应该和console.log后的c一样

[英]Why is the b same as c at the console.log part? B should be same as c after the console.log

在计算中使用 c 后,我试图将 b 分配给 c,它们现在不能同时相等,console.log 返回它们都具有相同的数字

 let b = 1, c = 1; for (i = 0; i < 8; i++) { let a = b + c; c = a; a = b + c; console.log(b); console.log(c); b = c; }

它不一样,只是添加一些分离在控制台中看到。

 let b = 1, c = 1; for (i = 0; i < 8; i++) { let a = b + c; c = a; a = b + c; console.log(b); console.log(c); console.log('-------------------------'); b = c; }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM