JS Intro Introduction to JavaScript - basic output JavaScript input with prompt and confirm Variable How Computers Work - Playlist
JavaScript (JS) is a lightweight, interpreted, or just-in-time compiled programming language with first-class functions. While it is most well-known as the scripting language for Web pages, many non-browser environments also use it, such as Node.js, Apache CouchDB and Adobe Acrobat. JavaScript is a prototype-based, multi-paradigm, single-threaded, dynamic language, supporting object-oriented, imperative, and declarative (e.g. functional programming) styles.
<script>
tag is usedCode | Does |
---|---|
alert() |
Creates a pop-up with the alert text inside |
document.write() |
Changes the content on the page to what is inside the document.write() function |
console.log() |
Prints the contents of the console.log() call into the console for us to read |
prompt() |
Shows a pop-up window asking for a user’s input |
confirm() |
Provides a Yes or No confirmation to the user; typically paired with an IF / ELSE statement |
var
let
const
let person = "John"
person
is the identifier$
_
var x = 5;
var y = 6;
var z = x + y;
console.log(z) >> 11
const
?const
const
cannot be accidentally modified later in the program
const
, you will get an error messagelet
const price1 = 5;
const price2 = 6;
let total = price1 + price2;
console.log(total) >> 11