USE JAVASCRIPT

USE JAVASCRIPT

Q1: Create a function that displays each character of this string on the screen with a space between each letter. The string must appear on one line

Example output: * H e l l o W o r l d , I ‘ m a n e w j a v a s c r i p t p r o g r a m m e r *

const stringData = “Hello World, I’m a new javascript programmer”;

Q2: Replace all of the pipe “|” characters with a comma “,”. Note, Older versions of

Javascript do not have a replaceall function. Find a way to replace these.

Example output:

Harry,Jim,Jeswin,Gurpreet,Sam,Tobias,Angel,Tong

var names = “Harry|Jim|Jeswin|Gurpreet|Sam|Tobias|Angel|Tong”;

Q3: Split the names string into an ARRAY based on the ‘,’ and display the names vertically on the screen

Example Output: * Harry * Jim * Jeswin * Gurpreet * Sam * Tobias * Angel * Tong

Q4: Write a function that extracts the area code from a phone number and display it

on the screen. You can use a regex if you want, but your function must work for

all three types of phone numbers.

Example Output:

519

var phoneNum1 = “(519)-555-5555”;

var phoneNum2 = “519-555-5555”;

var phoneNum3 = “5195555555”;

Q5: Create a simple int array that holds X amout of numbers. Initalize the array

when you create it. Output the array to the screen.

Example Output: * 5,5,6,10,3,1,6 *

Complete Answer:

Get Instant Help in Homework Asap
Get Instant Help in Homework Asap
Calculate your paper price
Pages (550 words)
Approximate price: -
Open chat
1
Hello 👋
Thank you for choosing our assignment help service!
How can I help you?