Learning javascript - study notes

Due to the Coronavirus (COVID-19) outbreak, I've decided to learn a new skill. I was always interested in computer programming, and I felt like there was no time like the present. So I just started learning JavaScript through TeamTreehouse.com and have decided to make my study notes public. I will be referring here for my notes but I also invite anybody else who's learning JavaScript to have a peek. Wish me luck!
Course: JavaScript Basics
Date: Friday, April 3, 2020
  • One of the most in-demand developer skills
  • The most common place to find JavaScript is on the web
  • Because it's implemented in a web browser, you don't need any additional files to get started
  • You can run a script in your browser by opening the console, pasting your script in there and hitting ENTER
  • prompt is used to receive an input from the user. ie. prompt("What is your name?  ")
  • JavaScript doesn't only run on browsers. Using JavaScript you can build apps and software that can be used by anyone on just about any device. 
  • Syntax is a programming language's rules, like vocabulary and grammar. Syntax is the language's commands, special words, and punctuation. https://developer.mozilla.org/en-US/docs/Glossary/Syntax
  • Variables, Data Types, and Conditional Statements are concepts not only found in JavaScript but other programming languages as well.
  • alert(); command opens up a dialogue box
  • alert("Hello World!"); comment opens a dialogue box that displays your alert.
  • These alerts are examples of a JavaScript Statement - are like sentences. How sentences end with a period, JavaScript sentences end with a semi-colon ;
  • console.log(); is going to log or print the message you type in the parentheses to the Console.
  • document.write(); is a command that writes something to the current document. Not the most common way to display content on a webpage, but useful in situations.
  • One statement needs to complete before the next statement can run.
  •  JavaScript Engine - a program (or interpreter) built into the browser that executes JavaScript code. Browsers all have a JavaScript engine.
  • To link a JavaScript file (.js) to an HTML file (.html) you use a . This script tag goes inside the of the HTML file.
  • Information that changes is stored in a VARIABLE
  • Score in a game is a VARIABLE.
  • var is short for VARIABLE and it creates a variable. This is what's called Declaring a Variable. For instance, var score = 0; 
  • When you place something in a VARIABLE it's called assigning a value to the variable.
  • JavaScript has a long list of reserved words. You can't create a variable named 'var' for instance. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#Keywords
  • score = score + 10; is the same as score += 10. It's the shorthand method to add to the value of the variable score
  • const and let also work similar to var, you can store variables in them. But they have different rules and can make your code less error-prone.
  • const is short for constant and is the most useful. Once you create a constant and assign it a value, you can't assign it another value. You can't or manipulate it's value. 
  • Use the let keyword when you want to reassign a variable. The let keyword is almost the same as var. 
  • JavaScript doesn't care too much about spaces. You can even spread a single JavaScript statement over multiple lines.
  • To make a string upper case, concatenate using the .toUpperCase() dot notation. For instance firstName.toUpperCase() 
  • To make a string lower case, concatenate using the .toLowerCase() dot notation. For instance firstName.toLowerCase() 
  • To count the length of a string, use the .length dot notation when concatenating. For instance, fullName.length;
  • In JavaScript, a string can contain HTML tags like

  • If something has a () after it, it's called a METHOD. For instance, prompt() is a prompt METHOD.
  • String Concatenation is the process of combining two strings together to create a bigger string.

"Click the button to generate a quote" -Sepy Bazzazi