Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Management With Website Development Applications

Authors: Greg Riccardi

1st Edition

0201743876, 978-0201743876

More Books

Students also viewed these Databases questions

Question

Question What is a Roth 401(k) feature?

Answered: 1 week ago