0% found this document useful (0 votes)
3 views2 pages

Javascript

The document outlines various methods for writing output in JavaScript, including using innerHTML, document.write(), alert boxes, console.log(), and window.print(). It also discusses variable declarations with const, let, and var, highlighting their scope, redeclaration, reassignment, and hoisting characteristics. Additionally, it provides rules for naming variables and mentions the use of jQuery for selecting HTML elements.

Uploaded by

Kameliya Kowser
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views2 pages

Javascript

The document outlines various methods for writing output in JavaScript, including using innerHTML, document.write(), alert boxes, console.log(), and window.print(). It also discusses variable declarations with const, let, and var, highlighting their scope, redeclaration, reassignment, and hoisting characteristics. Additionally, it provides rules for naming variables and mentions the use of jQuery for selecting HTML elements.

Uploaded by

Kameliya Kowser
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

●​ Writing into an HTML element, using innerHTML(‘’)

{document.getElementByID(xyz).}
●​ Writing into the HTML output using document.write()
●​ Writing into an alert box, using window.alert()
●​ Writing into the browser console, using console.log()
●​ To print the entire page window.print()

One line comment // xyz


Paragraph comment /* xyz */

Variables
●​ Const x = 5; (constant value)
●​ Let x = 5 ; (varied value)
●​ Var x = 5 ; (for old browsers)

Scope Redeclare Reassign Hoisted Binds This


var No Yes Yes Yes Yes
let Yes No Yes No No
const Yes No No No No

The general rules for constructing names for variables (unique


identifiers) are:

●​ Names can contain letters, digits, underscores, and dollar signs.


●​ Names must begin with a letter.
●​ Names can also begin with $ and _ (but we will not use it in this
tutorial).
●​ Names are case sensitive (y and Y are different variables).
●​ Reserved words (like JavaScript keywords) cannot be used as
names.

Reassigning a variable overwrites the original value of that variable

$("p"); means "select all p elements".

Shift assignment operators for larger values

You might also like