Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

Final Project Create as an HTML document a JavaScript Cheat Sheet. Save the document as YourName_JSFinal.html The JS CheatSheet is structured in two main sections: 1. JavaScript Language Fundamentals...

1 answer below »
Final Project
Create as an HTML document a JavaScript Cheat Sheet. Save the document as YourName_JSFinal.html
The JS CheatSheet is structured in two main sections:
1. JavaScript Language Fundamentals
This section must have the following subsections:
1.1. Variables
1.2. Operators
1.3. Conditional Statements (if …else if , switch)
1.4. Loops (for loop + your choice of another loop)
1.5. Functions
1.6. JS ObjectsGeneral Overview
1.7. JS Built-in Objects – A List of at least 5 built-in JS objects
1.8. A
ay Object (in detail)
1.9. String Object (in detail)
2. JavaScript - Web Browser - Web Document Interaction
This section must have the following subsections:
2.1. Browser Objects
2.2. HTML Objects
2.3. Events
For each subsection, please detail:
· The general syntax , methods and properties (if applicable)
· A link to a working code example with comments displayed in the output document. Each code example should be related to the topic of the subsection.
Bundle together the main page and the sample files. Save the archive as YourName_JSFinal.zip
1

Final Project Ru
ic
    Criteria
    Beginning to meet standard
    Approaching Standard
    Meets
Standard
    Valid HTML and JS throughout document
    Document has several validation e
ors.
(0)
    Document has minor validation e
ors.
(.5)
    Document has no validation e
ors.
(1)
    JavaScript Language Fundamentals section
    Section is not complete or is missing most content.
(0)
    Section is mostly complete, with some content and coding examples.
(2.5)
    Section is complete with required content and coding examples.
(5)
    JavaScript – Web Browser – Web Document Interaction section
    Section is not complete or is missing most content.
(0)
    Section is mostly complete, with some content and coding examples.
(2.5)
    Section is complete with required content and coding examples are complete and match topic of subsection.
(5)
    Coding Example comments
    Coding examples do not display comments on the output document.
(0)
    Coding examples display some comments on the output document.
(1)
    Coding examples display comments on the output document.
(2)
    File Submission
    File is not submitted co
ectly.
    File is submitted as a bundled main page and sample files, following the naming ocnvention of YourName_JSFinal.zip

1
Answered Same Day Nov 28, 2021

Solution

Ayush answered on Dec 06 2021
144 Votes
Assignment 72750/72750/anchor.html

JavaScript Fundamentals




Code Snippet

var x = document.getElementById("myAnchor").href;
document.getElementById("myDIV").innerHTML = x;

Google
Try Here


Result



Assignment 72750/72750/a
ayobject.html

JavaScript Fundamentals




Code Snippet

var div = document.getElementById("myDIV");
var text = "";
var fruits = [ "apple", "orange", "mango" ];
for(var i =0; i < 3; i++){
text+=fruits[i] + " is element " + i + "\n" ;
}
div.innerText=text;

Try Here


Result



Assignment 72750/72750
aseobject.html

JavaScript Fundamentals




Code Snippet

function myFunction() {
var x = document.getElementById("htmldom").target;
document.getElementById("myDIV").innerHTML = "Base target for all links: " + x;
}

Click the button to display the value of the target attribute of the base element.
Try Here


Result


Assignment 72750/72750/cookies.html

JavaScript Fundamentals




Code Snippet

var sum = myFunction(7, 8);
document.getElementById("myDIV").innerHTML = sum;
function myFunction(a, b) {
return a * b;
}

Try Here


Result



Assignment 72750/72750/event.html

JavaScript Fundamentals




Code Snippet

function displayDate() {
document.getElementById("myDIV").innerHTML = Date();
}

Click the button to display the date.
The Date is ...


Result



Assignment 72750/72750/forloop.html

JavaScript Fundamentals




Code Snippet

var div = document.getElementById("myDIV");
let text = "";
for (i = 0; i < 5; i++) {
text +="The number is " + i + "\n" ;
}
div.innerText=text;

Try Here


Result



Assignment 72750/72750/function.html

JavaScript Fundamentals




Code Snippet

var sum = myFunction(7, 8);
document.getElementById("myDIV").innerHTML = sum;
function myFunction(a, b) {
return a * b;
}

Try Here


Result



Assignment 72750/72750/image.html

JavaScript Fundamentals




Code Snippet

function myFunction() {
var x = document.getElementById("myImg").alt;
document.getElementById("demo").innerHTML = x;
}


Click the button to display the alternate text of the image.
Try Here


Result




Assignment 72750/72750/JSFinal.html

JavaScript Cheat Sheet


JavaScript Fundamentals


1.1 Variables

1.2 Operators

1.3 Conditional Statements

1.4 Loops

1.5 Functions

1.6 JS ObjectsGeneral Overview

1.7 JS Built-in Objects

1.8 A
ay Object

1.9 String

1.1 Javascript Variables
A JavaScript variable is simply a name of storage location. There are two types of variables in
JavaScript : local variable and global variable.
There are some rules while declaring a JavaScript variable (also known as identifiers).
        
Name must start with a letter (a to z or A to Z), underscore( _ ), or dollar( $ ) sign.
        After first letter we can use digits (0 to 9), for example value1.
        JavaScript variables are case sensitive, for example x and X are different variables.,
var x = 10;
var _value="sonoo";
Try an Example
1.2 Operators


var x = 5;
assign the value 5 to x
var y = 2;
assign the value 2 to y
var z = x + y;
assign the value 7 to z (5 + 2)

The assignment operator (=) assigns a value to a variable.
-**Assignment

var x = 10;

The addition operator (+) adds numbers:
Adding

var x = 5;
var y = 2;
var z = x + y;



The multiplication operator (*) multiplies numbers.


Multiplying

var x = 5;
var y = 2;
var z = x * y;


Try an Example

JavaScript Arithmetic Operators
Arithmetic operators are used to perform arithmetic on numbers:

Operator Description
        +        Addition
        -        Subtraction
        *        Multiplication
        **        Exponentiation (ES2016)
        /        Division
        %        Modulus (Division Remainder)
        ++        Increment
        --        Decrement
JavaScript Assignment Operators
Assignment operators assign values to JavaScript variables.

        Operato
        Example
        Same As

        = x
        = y         x = y

        += x
        += y
        x = x + y

        -= x
        -= y
        x = x - y

        *= x
        *= y
        x = x * y

        *= x
        *= y
        x = x * y

        /= x
        /= y
        x = x / y

        %= x
        %= y
        x = x % y

        **= x
        **= y
        x = x ** y

The addition assignment operator (+=) adds a value to a variable.

1.3 Conditional Statements
Very often when you write code, you want to perform different actions for different decisions.
You can use conditional statements in your code to do this.

In JavaScript we have the following conditional statements:

        Use if to specify a block of code to be executed, if a specified condition is true
         Use else to specify a block of code to be executed, if the same condition is false
         Use else if to specify a new condition to test, if the first condition is false
         Use switch to specify many alternative blocks of code to be executed



The if Statement
Use the if statement to specify a block of JavaScript code to be executed if a condition is
true.


if (hou
< 18)
{ greeting="Good day" ; }



The else Statement
Use the else statement to specify a block of code to be executed if the condition is false.


if (condition) {

block of code to be executed if the condition is true
} else {

block of code to be executed if the condition is false
}



The else if Statement
Use the else if statement to specify a new condition if the first condition is false.


if (condition1) {

block of code to be executed if condition1 is true
} else if (condition2) {

block of code to be executed if the condition1 is false and condition2 is true
} else {

block of code to be executed if the condition1 is false and condition2 is false
}



The JavaScript Switch Statement
Use the switch statement to select one of many code blocks to be executed.
Syntax


switch(expression) {
case x:

code block

eak;
case y:

code block

eak;
default:

code block
}


This is how it works:
The switch expression is evaluated once.


        The value of the expression is compared with the values of each case.
        If there is a match, the associated block of code is executed.
        If there is no match, the default code block is executed.


Example

The getDay() method returns the weekday as a number between 0 and 6.



(Sunday=0, Monday=1, Tuesday=2 ..)

This example uses the weekday number to calculate the weekday name:


switch (new...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here