← Quiz: HTTP Methods, Status Codes and Headers: all 10 questions
Quiz: HTTP Methods, Status Codes and Headers · Question 5 of 10
What does this print? (code)
What does this print?
const codes = [201, 404, 503, 302];
console.log(codes.map((c) => Math.floor(c / 100) + "xx").join(" "));
- A.2xx 3xx 4xx 5xx
- B.2xx 4xx 5xx 3xx
- C.201xx 404xx 503xx 302xx
- D.2 4 5 3
Answer & explanation
Correct answer: 2xx 4xx 5xx 3xx
Dividing by 100 and flooring gives the first digit, which is the status family.
Can you get the rest right without peeking?
Take the timed Quiz: HTTP Methods, Status Codes and Headers quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →