Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Enter Script ; Enter and debug this script. It has been tested and it works. If you cut and paste this text into your

1. Enter Script ; Enter and debug this script. It has been tested and it works. If you cut and paste this text into your source code editor, be careful with the double quote characters. You might need to delete and retype the double quotes. This script shows the use of an object to hold some data about a fictitious person.

The expected output is the approximate age of someone born in 1982. Note the use of the Date() built-in object.

2. Write Your Own Script # 1 Given below is a small JavaScript function that multiplies two numbers together and returns the result: function mult(a, b) { var c = a * b; return c; } Create a simple HTML page, in a format similar to the one used in problem 1 (that is: a very simple HTML page), which uses this mult() function to compute the product of 3 times 4. You will need to copy the function above into your HTML file. To get credit for this problem, you must use the function provided to generate the product. The output should look something like:

image text in transcribed

3. Write Your Own Script #2 Using the above scripts as models, write a script that generates a random number and outputs the number via the alert() method. In addition, have your script generate a second random number between 1 and 20 and output it via alert(). Both of our textbooks touch on how to generate random numbers in JavaScript and you can also learn more about it using Google/Bing. With Chrome, correct results from this HTML page and script should look something like the displays below. Hopefully, it is clear that the actual numbers you see might be different; however, the number shown in the second display box must be >= 1,

image text in transcribed

4.Write Your Own Script #3 Using the above scripts as models and the JavaScript String() description on Duckett page 128 & the Date() description on Duckett page 136, write a script that determines the current month, converts it to upper case, and outputs the first three letters of the upper-case month. So if the current month is January then result should be JAN. You may output the result with alert() or with the DOM object & innerHTML. Use of the DOM object is optional at this point. These is a small complication in this assignment. The Date objects setMonth() method returns 3 Copyright 2017 by Robert W. Senser, Jr the number of the month(0-11) and not the name of the month. Drat! We need the name of the month. You can get beyond this issue with something like these few lines of JavaScript code. var mlist = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ]; var mName = mlist[1]; /* you will likely have to change this line . */ This code declares variable mlist and uses it as an array to hold the twelve month names. Since January as 0, February as 1, etc. is exactly what we need to map month number to month name, this works perfectly as a Q&D way to covert to the month name. With Chrome, correct results from this HTML page and script might look like:

image text in transcribed

PLS I NEED A SOLUTION AND TO THIS WORK THANKS

This pape says: First Randem Number 0.058s73969762815254 Prevent this page hom creating addional diabgi. Goople IK Kinsle C C hwozn3 X (1) file /// /affocc-175pring-h. r This page says: Second Random Number 13 Prevent this page tom creasing additionul dalogk. This page says: Month is JAN Prevent this page from creating additional dialogs

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

Recommended Textbook for

Information Modeling And Relational Databases

Authors: Terry Halpin, Tony Morgan

2nd Edition

0123735688, 978-0123735683

More Books

Students also viewed these Databases questions

Question

How can you defend against SQL injection attacks?

Answered: 1 week ago

Question

What is the purpose of the Salary Structure Table?

Answered: 1 week ago

Question

What is the scope and use of a Job Family Table?

Answered: 1 week ago