Programming Fundamentals/Variable Examples JavaScript

Overview
The following examples demonstrate data types, arithmetic operations, and input in JavaScript.

Output
Number n = 1.23456789012345 String s = string Boolean b = true

Discussion
Each code element represents:
 * begins a comment
 * define variables
 * ends each line of JavaScript code
 * assign literal values to the corresponding variables
 * calls the output function
 * defines a output function that checks the JavaScript environment and writes to the current document, the console, or standard output as appropriate.

Output
a = 3 b = 2 a + b = 5 a - b = 1 a * b = 6 a / b = 1.5 a % b = 1

Discussion
Each new code element represents:
 * represent addition, subtraction, multiplication, division, and modulus, respectively.

Output
Enter Fahrenheit temperature: 100 100° Fahrenheit is 37.7777777777778° Celsius

Discussion
Each new code element represents:
 * defines a function that checks the JavaScript environment and reads from the current window, the console, or standard input as appropriate.