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

function getFine(speed, amount) {
const formattedSpeed = new Intl.NumberFormat('en-US', {
style: 'unit',
unit: 'mile-per-hour'
}).format(speed);

const formattedAmount = new Intl.NumberFormat('en-US', {
style: 'currency',
currency: 'USD'
}).format(amount);

return `The driver drove ${formattedSpeed} and has to pay ${formattedAmount}`;
}

console.log(getFine(130, 300))
127. What's the output?

const spookyItems = ['👻', '🎃', '🕸'];
({ item: spookyItems[3] } = { item: '💀' });

console.log(spookyItems);
128. What's the output?

const name = 'Lydia Hallie';
const age = 21;

console.log(Number.isNaN(name));
console.log(Number.isNaN(age));

console.log(isNaN(name));
console.log(isNaN(age));
129. What's the output?

const randomValue = 21;

function getInfo() {
console.log(typeof randomValue);
const randomValue = 'Lydia Hallie';
}

getInfo();
129. What's the output?

Javob variantlari:
Anonymous Quiz
0%
A: "number"
0%
B: "string"
0%
C: undefined
100%
D: ReferenceError
130. What's the output?

const myPromise = Promise.resolve('Woah some cool data');

(async () => {
try {
console.log(await myPromise);
} catch {
throw new Error(`Oops didn't work`);
} finally {
console.log('Oh finally!');
}
})();