This is the third day of my participation in Gwen Challenge

46. What is the output?

let person = { name: "Lydia" };
const members = [person];
person = null;

console.log(members);
Copy the code

A: A person [0] should be null in members. A person [0] should be null in members. Person [0] is null. [b] is null. [C] is null.

47. What is the output?

const person = {
  name: "Lydia".age: 21
};

for (const item in person) {
  console.log(item);
}
Copy the code

A for in loop B for in loop C for in loop D for in loop

48. What is the output?

console.log(3 + 4 + "5");
Copy the code

A: B, this question examines the operator

49. What is the value of num?

const num = parseInt("7" x 6".10);
Copy the code

A) parseInt b) parseInt C) parseInt D) parseInt

50. What is the output?

[1.2.3].map(num= > {
  if (typeof num === "number") return;
  return num * 2;
});
Copy the code

A) map B) map C) map D) map

51. What is the output?

function getInfo(member, year) {
  member.name = "Lydia";
  year = "1998";
}

const person = { name: "Sarah" };
const birthYear = "1997";

getInfo(person, birthYear);

console.log(person, birthYear);
Copy the code

When passing an object by reference, reference passing affects the reference itself, but value passing does not.

52. What is the output?

function greeting() {
  throw "Hello world!";
}

function sayHi() {
  try {
    const data = greeting();
    console.log("It worked!", data);
  } catch (e) {
    console.log("Oh no an error:", e);
  }
}

sayHi();
Copy the code

D) when the greeting function returns an error, it stops executing the other statements in the try and passes the error string to e.

53. What is the output?

function Car() {
  this.make = "Lamborghini";
  return { make: "Maserati" };
}

const myCar = new Car();
console.log(myCar.make);
Copy the code

B) the value returned by the constructor is not the value set by the constructor

54. What is the output?

(() = > {
  let x = (y = 10); }) ();console.log(typeof x);
console.log(typeof y);
Copy the code

A) the function is executed immediately. B) the function is executed immediately. C) the function is executed immediately.

55. What is the output?

class Dog {
  constructor(name) {
    this.name = name;
  }
}

Dog.prototype.bark = function() {
  console.log(`Woof I am The ${this.name}`);
};

const pet = new Dog("Mara");

pet.bark();

delete Dog.prototype.bark;

pet.bark();
Copy the code

A, this in the prototype object also refers to the instance object, so the first part of the three options ABC is correct. The bark method on the prototype object is deleted by the delete method. Therefore, calling bark again at this time will give an error, so only A is correct at this time.

Title source

Github.com/lydiahallie…