Daily JavaScript
15 subscribers
1 photo
1 link
Daily examples, coding challenges, and useful tips for developers.
Download Telegram
85. What kind of information would get logged?

fetch('https://www.website.com/api/user/1')
.then(res => res.json())
.then(res => console.log(res));
86. Which option is a way to set hasName equal to true, provided you cannot pass true as an argument?

function getName(name) {
const hasName = //
}
86. Which option is a way to set hasName equal to true, provided you cannot pass true as an argument?

Javob variantlari:
Anonymous Quiz
0%
A: !!name
100%
B: name
0%
C: new Boolean(name)
0%
D: name.length
87. What's the output?

console.log('I want pizza'[0]);
Anonymous Quiz
0%
A: """
100%
B: "I"
0%
C: SyntaxError
0%
D: undefined
88. What's the output?

function sum(num1, num2 = num1) {
console.log(num1 + num2);
}

sum(10);
88. What's the output?

Javob variantlari:
Anonymous Quiz
0%
A: NaN
100%
B: 20
0%
C: ReferenceError
0%
D: undefined
89. What's the output?

// module.js
export default () => 'Hello world';
export const name = 'Lydia';

// index.js
import * as data from './module';

console.log(data);
90. What's the output?

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

const member = new Person('John');
console.log(typeof member);
90. What's the output?

Javob variantlari:
Anonymous Quiz
0%
A: "class"
0%
B: "function"
0%
C: "object"
0%
D: "string"
91. What's the output?

let newList = [1, 2, 3].push(4);

console.log(newList.push(5));
91. What's the output?

Javob variantlari:
Anonymous Quiz
0%
A: [1, 2, 3, 4, 5]
0%
B: [1, 2, 3, 5]
0%
C: [1, 2, 3, 4]
0%
D: Error
92. What's the output?

function giveLydiaPizza() {
return 'Here is pizza!';
}

const giveLydiaChocolate = () =>
"Here's chocolate... now go hit the gym already.";

console.log(giveLydiaPizza.prototype);
console.log(giveLydiaChocolate.prototype);
93. What's the output?

const person = {
name: 'Lydia',
age: 21,
};

for (const [x, y] of Object.entries(person)) {
console.log(x, y);
}
94. What's the output?

function getItems(fruitList, ...args, favoriteFruit) {
return [...fruitList, ...args, favoriteFruit]
}

getItems(["banana", "apple"], "pear", "orange")