Last revised May 4, 2025, 2:00 pm
<html> <body> <head> <meta> <title> <link> <script> <h1> <h2> <p> <ul> <ol> <li> <table> <tr> <th> <td> <input> <label> <button> <textarea> <span> <option> <img> <a>
alt href id lang rel src style type value
color background-color test-align font-family font-size font-weight font-style width height
font border margin padding
red lime blue yellow aqua magenta maroon green navy olive teal purple white black gray silver
else false for function if new return this true typeof var while
boolean null number object string undefined
document.writeln(Number.MAX_VALUE); // Output: 1.7976931348623157e+308
Infinity -Infinity NaN
"" (Null String)
false true
Arithmetic: + - * / ** % Comparison: == === < <= > >= != !== Logical: && || Assignment: = += -= *= /= **= %= Miscellaneous: . [ ] ( ) { } typeof new
if if..else if..else while loop traditional for loop modern for loop
isFinite isNaN parseFloat parseInt
Convert value to String object: v.toString( ) or String(v) or v + "" or `${v}` Convert string value s to double or float, parseFloat(s) or parseInt(s)
length
pop push shift slice splice toString unshift
length
charAt endsWith includes indexOf lastIndexOf repeat startsWith substr substring toLowerCase toUpperCase trim
abs ceil floor random round
document.getElementById
innerHTML src style value
click load
Let obj be the object that represents the HTML element. Let f be the event listener to attach. Two ways to attach f to obj: obj.addEventListener("click", f); obj.onclick = f; or obj.addEventListener("load", f); obj.onload = f;
JSON methods: JSON.stringify JSON.parse Example array of object literals: var kidsArray = [ {name: "Alice", age: 11}, {name: "Bob", age: 9} ]; var kids = `[{"name":"Alice","age":11}, {"name":"Bob","age":9}]`;
var k = new Kid("Alice", "F", 11);
document.writeln(k);