Javascript differences from C++:

(some of them, not all of them. For that, read the textbook).

No file input or output for security reasons. Would you want to download a web page that could access your files?

User input from form widgets: button clicks, text field changes, mouse moves.
Input also from prompt and confirm functions of window.
Output with alert function and by changing text of buttons, text fields and other widgets. (Debugging hint: use alert to display values of variables).

Javascript is untyped. variables are string or numeric (double) by context: (like shell variable, or VB variant)

var i;
i = "hello";		//now it's a string
i = 45;			//now it's numeric

No char type.

strings, single or double quotes OK: "hello" or 'hello'

+ is string concatenation:

var msg="hello ";
msg += "world";     //now it's "hello world"

Slight bias towards strings:
"10" + 3 is "103"
the number 3 gets converted to string "3"

boolean true, false:

var done;
done = false;
while (!done) ...

Arrays are dynamically allocated. Array elements can be different types:

var A = new Array(6);    //create array of 6 elements, indexed from 0 thru 5
A[3] = "hello";
A[4] = 23.546;
A[2] = new Array(10);		//element is array of 10 elts

2D arrays: create array, then create array for each element

var B = new Array(6);
for (i=0; i<6; i++)
  B[i] = new Array(14);      //6 rows, each 14 columns

B[i][j] = 3.14159;
B[i][4] = "hi";

see reference part of textbook for properties and methods of built-in classes:
Array: Can know its length. Can do various methods: sort, reverse, slice, splice, push/pop, shift/unshift...

var A = new Array(i);  //variable as size
for (j=0; j<A.length; j++)
  A[j] = Math.sqrt(j);
String: length, split, substring, match, search, slice, charAt, indexOf...
var msg = "hello mom";
for (i=0; i<msg.length; i++)  //loop over chars of string
  if (msg.charAt(i) == 'm')   //change m to M
    msg.charAt(i) = 'M';
Date: and time stuff
Math: sqrt, random, floor
x = Math.random() * 100;  //random number between 0 and 100
y = Math.floor(x);        //round down to nearest integer

Function definition: no return type, no types of arguments

function myfunc (myarg1, myarg2) {

//def'n 

}
Neither number nor types of args are syntax-checked.