back to coding

see also:
html
css

The programming language of the web.

"use strict"; - put this on the top of the script to make it error when using undeclared variables.

examples:
One Line Notepad - what you type is saved to localStorage.
clock - A clock in javascript
window.onload - faerie moves on onload event
mouse coords - display the coordinates by moving the mouse over the page
Gamepad - how to detect a game pad
download local storage - saves and opens a file, lets you set or download to and from local storage
tilemap - platformer. Can save and load from localstorage, use the gamepad, play sound

Some javascript files the pages are using
smart quotes div.js replace quotes with smart quotes in all divs, except with class noquote
smart quotes.js replace quotes with smart quotes in all paragraphs, except with class noquote
/sorttable.js - sorts a table with the class of sortable

string methods
.substring(first_position, last_position) - returns that part of the string. starts counting at 0
.split("delimiter ") - returns array of string separated by the argument
.indexOf("text to find", number_to_start_from) - returns -1 if not found
.lastIndexOf("text to find") - position of last one found
.includes("text to find") - true or false if the text is in
.replace("string to replace", "what replaces it")
.toLowerCase()
.toUpperCase()
.trim() - remove spaces on left and right
.trimStart() - remove spaces on left
.trimEnd() - remove spaces on right
.concat("to add to the end") - exists but just use +
.repeat(number_of_times_to_repeat)
.length - property that is the length

`literal with ${expression} in it` - backticks. The expression in ${} is put in the string

some math methods
Math.pow(number, exponent)
Math.random() - number from 0 up to but not including 1
Math.floor(number) - round down to integer
Math.ceil(number) - round up to integer
Math.round(number) - round to nearest integer
Math.abs(number) - absolute value
Math.sin(number) Math.cos(number) Math.tan(number) Math.atan(number) - trig stuff