javascript-questions
javascript-questions copied to clipboard
Some errors I noticed in the questions
Errors: 126. new Intl.NumberFormat is not supposed to get passed a single object as param. The first param must be a string and the second param can be an object. 135. Spelling error ('tis' should be 'this').
Suggestion: 86. Needs to be more explicit by calling the function in the example. Calling getName() with any falsy value would not set hasName to true with your correct answer.
At question 126, can you tell me which one do you mean ?
because in my opinion, nothing seems wrong.
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))
Errors: 126. new Intl.NumberFormat is not supposed to get passed a single object as param. The first param must be a string and the second param can be an object. 135. Spelling error ('tis' should be 'this').
Suggestion: 86. Needs to be more explicit by calling the function in the example. Calling getName() with any falsy value would not set hasName to true with your correct answer.
https://github.com/lydiahallie/javascript-questions/commit/92998dc0253708918a351ec4a1a30fde80045342#diff-db01f1a85b3ca9366b6e37803624cdf6
this merge fixed it a while ago
Okay, i'll try to fix 135 and suggestion 86
Calling getName() with any falsy value would not set hasName to true with your correct answer. Which option is a way to set
hasName
equal totrue
Note that "a way" doesn't means "always". Seems like questions in this issue have been solved, so it can be closed, as well as #509. (cc @jakeherp)
Just a pip to say should this be closed now along with https://github.com/lydiahallie/javascript-questions/issues/509 ?