As always, spell check all content and identify your name and the current date in all files using comments. In html files you may use the html meta tag, e.g. <meta name="author" content="John Doe">.
<p> elements with id="q1", id="q2", and id="q3" respectively.Which JavaScript variable names are valid and why?
| variable name | valid? yes or no | If NOT valid, why NOT? If valid, from a best practices standpoint, is this a good variable name or not? If NOT, why NOT? |
|---|---|---|
JCCC |
||
$JCCC |
||
_JCCC |
||
%JCCC |
||
1jccc |
||
jccc |
||
jccc-ks |
||
jccc.ks |
||
var |
||
function |
||
streetaddress |
||
streetAddress |
||
StreetAddress |
||
street-Address |
In html file....
<body>, add 9 paragraph tags with id="p1" through id="p9" respectivelyscript tags just below the closing id="p9" tag that references a file named project3.js in the same folder as the html fileRender your page in the browser and fix any errors using the html and css validators! In the browser, open the Console. (right-click your browser|Inspect|click Console tab)
In external js file named project3.js, after a comment with your name and the current date....
months equal to ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep", "Oct","Nov","Dec"] (Hint: Do NOT use the new Array syntax. Use the clean JavaScript syntax such as textArray = ["text1", "text2"])console.log(months);Save your JavaScript, refresh your html page in the browser, and fix any errors noted in the Console! (aka. Save, refresh, fix, repeat.) You should see the values of your months array in the Console!
Expand your array list to see each element in the array by clicking the arrow to the left of it in the console.
In external js file...
months array item 0 to "January"Save, refresh, fix, repeat. Now the console.log statement logs the original array values but when you expand the array list in your console, you should see the value of the first element in the array change to January!
In external js file...
console.log statement after the "January" assignment statement.Save, refresh, fix, repeat.
Note that the first item in the months array now logs out as "January".
In external js file...
months array item 1 to "February"p1 paragraph to the first item in the months array. (Remember that arrays start with the index value of 0).p2 paragraph to the second item in the months array.p3 paragraph to the third item in the months array.Save, refresh, fix, repeat.
In external js file...
myBirthdayMonth and set it equal to a string that contains your birthday month (the complete month, not an abbreviation of the month)document.getElementById("p4").textContent = "My birthday is in the month of "+ myBirthdayMonth;
document.getElementById("p5").textContent = "My birthday is in the month of "+ insert the reference to the month array that holds the value of your birth month
document.getElementById('p6').textContent = 'My birthday is in the month of '+ myBirthdayMonth;
document.getElementById('p7').textContent = 'My birthday is in the month of '+ insert the reference to the month array that holds the value of your birth month<em> using the innerHTML property document.getElementById("p8").innerHTML = "My <em>birthday</em> is in the month of "+ myBirthdayMonth + " using the innerHTML property";
document.getElementById("p9").innerHTML = "My <em>birthday</em> is in the month of "+ insert the reference to the month array that holds the value of your birthday month + " using the innerHTML property";Save, refresh, fix, repeat.
| term | definition |
|---|---|
| function | |
| statement | |
| parameter | |
| argument | |
| return value | |
| function declaration | |
| function expression | |
| anonymous function | |
| immediately invoked function expression |
showTotal if it doesn't have any parameters? id="f1". showTotal if it has two parameters named tax and total and you wish to pass the number 2 as an argument to the tax parameter and 10 as an argument to the total parameter? id="f2".showTotal if it has two parameters named tax and total and you wish to pass the variable stateTax as an argument to the tax parameter and totalBeforeTax as an argument to the total parameter? id="f3".id="s1". id="s2".id="s3". | term | definition |
|---|---|
| object | |
| property | |
| method | |
| key | |
| literal notation | |
| dot notation | |
| constructor notation | |
| this | |
| undefined |
id="j1". id="j2". this refer to? id="j3". this refer to? id="j4". In your js file, declare the following items to store data. After each declaration, add a console.log statement to review the data in the browser console.
| Browser | Document | Global String | Global Number | Global Math | Global Date | |
|---|---|---|---|---|---|---|
| Example of a common method for that object | ||||||
| Explanation of example |
| String | Number | Boolean | Undefined | Null | |
|---|---|---|---|---|---|
| Provide an example of how to declare a variable with each of these data types. |