【Codecademy学习Javascript】数组与迭代器

1.常见的一些数组操作常见的一些数组操作.push : 添加在数组的尾部;返回添加后的数组的长度,原数组发生改变.pop : 尾部删除一个元素,返回这个被删除的元素,原数组发生改变。.unshift : 添加在数组的头部;返回添加后的数组的长度,原数组发生改变。.sh...

[Javascript函数]默认参数/匿名函数/箭头函数

1.函数可以设置默认参数Javascript 默认参数( ES6 中添加的功能之一)允许参数具有预定值,以防没有参数传递到函数中或者调用时参数未定义。function greeting (name = 'stranger') { console.log(`Hello, ${name}!`)...

【Codecademy学习Javascript】短路求值、三元操作等简化方法

1.短路求值(short-circuit evaluation):- false && anything // 被短路求值为false ,表达式的anything部分不会被求值 - true || anything // 被短路求值为true,表...

【Codecademy学习Javascript】狗年龄计算

题目:Dogs mature at a faster rate than human beings. We often say a dog’s age can be calculated in “dog years” to account for their growth compared t...

【Codecademy学习Javascript】温度转换

【使用Codecademy学习Javascript】温度转换练习代码// today is 293 Kelvin const kelvin = 293; let celsius = kelvin - 273; //Kelvin to Celsius by subtracting 273 fro...