Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2 . Create a variable called phone and assign the value 8 8 8 - 1 2 3 - 1 2 3 4 . Using

2. Create a variable called phone and assign the value 888-123-1234. Using the substring() function, output the area code (the 1st 3 characters).
3. Use the substr() function to return the phone number without the area code for the variable phone used in problem 2. For example, output 123-1234.
4. Create a variable called sentence with the text 'I love flavor ice cream!' Using the replace() function, replace the text 'flavor' with your favorite flavor.
5. Create variables called addr='123 Main St', city='Cleveland', state='Oh', and zip code=44115. Output the address in all uppercase letters as it would appear on the front of an envelope (newlines, commas, etc). Use the appropriate function to convert the strings to uppercase letters.
6. Create a variable called helpdesk and assign a value of 'HelpDesk@Tri-C.edu'. Use a string function to convert it to all lowercase letters and output the value.
7. Create a variable called id with a value of '007'. Use padStart() to output the value '000000007' with 9 characters total.
8. Create variables for firstName and lastName. Assign your name to the variables. Use template literals to output 'Hello firstName lastName!'. Template literals can be found in the "JS String Templates" tutorial.
9. Create a variable called joke with the following string: 'Why don't programmers like nature? It has too many bugs.' Define the value on multiple lines using back-tics syntax.
10. Write an expression that returns true from a call to isNaN(). Display the output returned from isNaN().
11. Use toFixed to output the results of 20+10/3 formatted like currency (2 decimal places) with dollars and cents.
12. Use parseInt() to output the whole number value for 10.335.
13. Use an appropriate function call to check to see if 20.5 is an integer.
14. Explain why the following call returns a value of undefined.
MAX_LENGTH of x = undefined
15. Create a Date object called d and assign the current date and time using new Date(). output the value of d.
16. Subtract 1 year from d and output the value.
17. Output the toUTCString() value of d.
18. Output only the year from d.
19. Output a short date with a format similar to 08-01-2035 using d.
20. Output the day of the week using d and getDay().

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 Reliability Engineering Designing And Operating Resilient Database Systems

Authors: Laine Campbell, Charity Majors

1st Edition

978-1491925942

More Books

Students also viewed these Databases questions