Question: Question 7 1. Create JavaScript codes, write a function that accepts a string argument. o function oddChars(str) 2. The function then returns the sum of

 Question 7 1. Create JavaScript codes, write a function that accepts

Question 7 1. Create JavaScript codes, write a function that accepts a string argument. o function oddChars(str) 2. The function then returns the sum of all the odd digits (1,3,5,7, and 9) found within the input argument. 3. If the input argument is not a string (e.g. typeof operator), then the function returns a zero. 4. In the end, test the function with the following examples: Return value (Sum of all the odd digits) Input argument 123456789 (non-string: number) 0 "a1b2c3d4e5f6" 9 (because 1 + 3 +5 = 9)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!