ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 16 - Certified JavaScript Developer I discussion

Report
Export

A developer wants to iterate through an array of objects and count the objects and count the objects whose property value, name, starts with the letter N.

Const arrObj = [{"name" : "Zach"} , {"name" : "Kate"},{"name" : "Alise"},{"name" : "Bob"},{"name" :

"Natham"},{"name" : "nathaniel"}

Refer to the code snippet below:

01 arrObj.reduce(( acc, curr) => {

02 //missing line 02

02 //missing line 03

04 ). 0);

Which missing lines 02 and 03 return the correct count?

A.
Const sum = curr.startsWith('N') ? 1: 0;Return acc +sum
Answers
A.
Const sum = curr.startsWith('N') ? 1: 0;Return acc +sum
B.
Const sum = curr.name.startsWith('N') ? 1: 0;Return acc +sum
Answers
B.
Const sum = curr.name.startsWith('N') ? 1: 0;Return acc +sum
C.
Const sum = curr.startsWIth('N') ? 1: 0;Return curr+ sum
Answers
C.
Const sum = curr.startsWIth('N') ? 1: 0;Return curr+ sum
D.
Const sum = curr.name.startsWIth('N') ? 1: 0;Return curr+ sum
Answers
D.
Const sum = curr.name.startsWIth('N') ? 1: 0;Return curr+ sum
Suggested answer: B
asked 23/09/2024
Mr. Michael Mettam
29 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first