Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started