Type coercion. When you mix different data types and JS converts data types into one data type ‘on the fly’, when it needs to.
You can declare variables without assigning values to the variables. This makes them print out ‘undeclared’.
Change the value of a variable with variable mutation. You can even change the data type.
var age = 26; age = 'thirty six';
Prompt function. You can set the value of a variable as the answer to a prompt.
var lastName = prompt('What is the last name?'); console.log(lastName);
Alert function. A window pops up with text you have defined and the option ‘OK’.
alert(name + ' is a ' + age + ' year old ' + job + '. Is he married? ' + isMarried + '.');
Here is what I did in this lecture. I found it pretty easy compared to Java, with easier syntax and few data types. I also like how it has an immediate impact on a webpage you can view. The prompt and alert functions are probably the biggest takeaways in this lecture, for me. Type coercion and mutation already seem familiar from Java although this is the first time I’ve heard them referred to as such.