每日3题#1以下代码执行后,控制台中的输出内容为?#//index.jsconsole.log(1);import{sum}from"./sum.js";console.log(sum(1,2));//sum.jsconsole.log(2);exportconstsum=(a,b)=>a+b
每日3题#
1 以下代码执行后,控制台中的输出内容为?#
console.log(1);
import { sum } from "./sum.js";
console.log(sum(1, 2));
console.log(2);
export const sum = (a, b) => a + b;
2 以下代码执行后,控制台中的输出内容为?#
const value = { number: 10 };
const multiply = (x = { ...value }) => {
console.log((x.number *= 2));
};
multiply();
multiply();
multiply(value);
multiply(value);
3 以下代码在浏览器的控制台中执行后,页面会发生什么变化#
[].forEach.call($$("*"), function (a) {
a.style.outline =
"1px solid red"
});
答案及解析#
1#
console.log(2);
export const sum = (a, b) => a + b;
console.log(1);
console.log(sum(1, 2));
console.log(1);
import { sum } from "./sum.js";
console.log(sum(1, 2));
console.log(2);
export const sum = (a, b) => a + b;
2#
const value = { number: 10 };
const multiply = (x = { ...value }) => {
console.log((x.number *= 2));
};
multiply();
multiply();
multiply(value);
multiply(value);
3#
[].forEach.call($$("*"), function (a) {
a.style.outline = "1px solid red";
});
[所有元素].forEach(function (a) {
a.style.outline = "1px solid red";
});