Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

How toremoveallspacesanddashesfromaStringvalue,andmakeitlowercase. I have been trying to figure out how to remove all the spaces and dashes from a string value, and also make it

How toremoveallspacesanddashesfromaStringvalue,andmakeitlowercase.

I have been trying to figure out how to remove all the spaces and dashes from a string value, and also make it lowercase in my abc function and my code just will not work.

I am doing this on visual studio code on a .js file

Basically the abc() function should have no spaces, or dashes, and all letters are lower case. Examples on how it should work like is below.

could you comment out how you got the 4 examples to work

example 1: abc('ABC')//returns'abc'(alllowercase)

example 2: abc('abc')//returns'abc'(thestringwasalreadycorrect,samevalue)

example 3: abc('ABC')//returns'abc'(lowercase,spaceremoved)

example 4: abc('ab-c')//returns'abc'(lowercase,spacesremoved,dashremoved)

empty function code below:

functionabc(value){

// replace this comment with the code

}

what I tried so far is below:

function abc(value) {

(str.replace(/\s/g,'',-));

}

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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Students also viewed these Programming questions