Daily JavaScript
15 subscribers
1 photo
1 link
Daily examples, coding challenges, and useful tips for developers.
Download Telegram
80. What is the output?

const list = [1 + 2, 1 * 2, 1 / 2];
console.log(list);
81. What is the output?

function sayHi(name) {
return `Hi there, ${name}`;
}

console.log(sayHi());
82. What is the output?

var status = '😎';

setTimeout(() => {
const status = '😍';

const data = {
status: 'πŸ₯‘',
getStatus() {
return this.status;
},
};

console.log(data.getStatus());
console.log(data.getStatus.call(this));
}, 0);
83. What is the output?

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

let city = person.city;
city = 'Amsterdam';

console.log(person);
84. What is the output?

function checkAge(age) {
if (age < 18) {
const message = "Sorry, you're too young.";
} else {
const message = "Yay! You're old enough!";
}

return message;
}

console.log(checkAge(21));
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"