This is the fourth day of my participation in Gwen Challenge

56. What is the output?

const set = new Set([1.1.2.3.4]);

console.log(set);
Copy the code

D) Print out 1, 2, 3, 4.

57. What is the output?

// counter.js
let counter = 10;
export default counter;
Copy the code
// index.js
import myCounter from "./counter";

myCounter += 1;

console.log(myCounter);
Copy the code

A: C, the imported module is read-only and cannot be modified.

58. What is the output?

const name = "Lydia";
age = 21;

console.log(delete name);
console.log(delete age);
Copy the code

A: A, just remember that attributes can be deleted, and defined variables cannot be deleted. Age is equivalent to adding attributes to global objects, and name is A defined variable.

59. What is the output?

const numbers = [1.2.3.4.5];
const [y] = numbers;

console.log(y);
Copy the code

Y = 1; y = 1; y = 1;

60. What is the output?

const user = { name: "Lydia".age: 21 };
const admin = { admin: true. user };console.log(admin);
Copy the code

B) deconstruct the object by extending the operator.

61. What is the output?

const person = { name: "Lydia" };

Object.defineProperty(person, "age", { value: 21 });

console.log(person);
console.log(Object.keys(person));
Copy the code

A) defineProperty B) defineProperty D) defineProperty

62. What is the output?

const settings = {
  username: "lydiahallie".level: 19.health: 90
};

const data = JSON.stringify(settings, ["level"."health"]);
console.log(data);
Copy the code

Json.stringify is A string that can be converted to A string.

63. What is the output?

let num = 10;

const increaseNumber = () = > num++;
const increasePassedNumber = number= > number++;

const num1 = increaseNumber();
const num2 = increasePassedNumber(num1);

console.log(num1);
console.log(num2);
Copy the code

A: x++ is called in the same order as x++.

64. What is the output?

const value = { number: 10 };

const multiply = (x = { ... value }) = > {
  console.log(x.number *= 2);
};

multiply();
multiply();
multiply(value);
multiply(value);
Copy the code

C) If a parameter is passed by default, a new object is created each time. If a parameter is passed by default, a new object is created each time.

65. What is the output?

[1.2.3.4].reduce((x, y) = > console.log(x, y));
Copy the code

The first parameter of reduce is the cumulator value, and the second parameter is the current element value. If the cumulator value is not specified, then the cumulator value is the value of the first element, that is, 1, and y is 2. The accumulator is undefined because there is no addition or subtraction operation.

Title source

Github.com/lydiahallie…

Welcome to pay attention to the column, daily update.