Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a JavaScript function (name it: capitalizeName) to implement the following task: ** function capitalizeName(name) takes one string parameter. ** the parameter may be a

Write a JavaScript function (name it: capitalizeName) to implement the following task:

** function capitalizeName(name) takes one string parameter.

** the parameter may be a full name, separated by white space (" "), e.g.

Bryan stevenson

** your function will capitalize the first letter of

firstName,

middleName, and

lastName

** your function returns the new capitalized name as a string.

Note:

(1) the name could be FirstName LastName, FirstName MiddleName LastName, or random input.

(2) you only recognize the name separator of white space (" ").

(3) if the name is already capitalized, just leave it as is.

refer to the sample runs below.

Sample runs:

Test your function using the following statements and include them in your submission.

console.log(capitalizeName("Bryan stevenson"));

console.log(capitalizeName("jayce a. tapia"));

console.log(capitalizeName("math"));

console.log(capitalizeName("I love programming"));

console.log(capitalizeName("1+2+3"));

console.log(capitalizeName("Good Morning"));

result:

Bryan Stevenson

Jayce A. Tapia

Math

I Love Programming

1+2+3

Good Morning

Step by Step Solution

There are 3 Steps involved in it

Step: 1

Heres a JavaScript function named capitalizeName that capitalizes the first letter of each word in a ... 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

Java Programming

Authors: Joyce Farrell

9th edition

1337397075, 978-1337397070

More Books

Students also viewed these Programming questions