javascript-questions icon indicating copy to clipboard operation
javascript-questions copied to clipboard

Some errors I noticed in the questions

Open keaton-codes-tech opened this issue 4 years ago • 5 comments

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.

keaton-codes-tech avatar Aug 06 '20 17:08 keaton-codes-tech

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.

tryoasnafi avatar Oct 01 '20 10:10 tryoasnafi

https://github.com/lydiahallie/javascript-questions/commit/92998dc0253708918a351ec4a1a30fde80045342#diff-db01f1a85b3ca9366b6e37803624cdf6

this merge fixed it a while ago

keaton-codes-tech avatar Oct 01 '20 13:10 keaton-codes-tech

Okay, i'll try to fix 135 and suggestion 86

tryoasnafi avatar Oct 01 '20 16:10 tryoasnafi

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 to true

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)

chinesedfan avatar Jan 14 '21 12:01 chinesedfan

Just a pip to say should this be closed now along with https://github.com/lydiahallie/javascript-questions/issues/509 ?

medic-code avatar Jun 11 '21 14:06 medic-code