摘要: let num = 0; for (let i = 1; i < 10; i++) { console.log(i);//1,2,3,4,5 //++在后,变量先参与其他运算,然后再自增 // debugger; //**调试很重要** if (i % 5 == 0) { break; // num 阅读全文
posted @ 2021-09-06 21:04 Caesar_Y 阅读(39) 评论(0) 推荐(0) 编辑
摘要: 自增:通过自增运算符可以使变量在自身的基础上加一。 自增符号:++ 自增分为: 前自增(++a); var a, b; a = 10; b = 20; // ++在前,变量先自增,然后再参与其他运算 let res = (++a) + (++b); console.log(res); // 32 c 阅读全文
posted @ 2021-09-06 17:42 Caesar_Y 阅读(598) 评论(0) 推荐(0) 编辑
摘要: const 的行为与let基本相同,唯一一个重要的区别是用它声明变量时必须同时初始化变量,且尝试修改const声明的变量会导致运行时错误 // const age = 26; // age = 35; // typeError :给常量赋值 //const 不允许重复声明 //const name 阅读全文
posted @ 2021-09-06 11:52 Caesar_Y 阅读(107) 评论(0) 推荐(0) 编辑