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

Programming The Perl DBI Database Programming With Perl

Authors: Tim Bunce, Alligator Descartes

1st Edition

1565926994, 978-1565926998

More Books

Students also viewed these Databases questions

Question

Describe the three sections of a cash budget.

Answered: 1 week ago