Learning Javascript Lesson 1

Today we will be learning some basic features of the programming language Javascript. So far we’ve been independently working away with CodeAcademy, so treat today’s lesson as a summary to make sure you understand some important concepts.

To begin create an account at JSFiddle and then copy the following code into a new JSFiddle project. If you want an extra challenge than feel free to type out the code instead of copying it, practice makes perfect after all.


// Variables
  // var SOMETHING = SOMETHING
var name = "Rafi Khan"

// Numbers
var aNumber = 12

// Booleans
var likeSchool = false

// Strings
var school = "Bedford Road Collegiate"

// Getting feedback
// console.log(TEXT)
console.log("Hi! I am learning to program")

// Control Statements

/* if (TEST) { 
	PUT WHAT YOU WANT TO HAPPEN IF TEST IS TRUE
}
*/

if (likeSchool) {

  console.log("I like School")

}

// Functions
var print = function(input) {
	// input here is whatever variable you give to the function
  console.log(input)
}

Once you are done your screen should look something like this. While you are waiting feel free to research the terms strings, variables, booleans, numbers, javascript, functions on Google to get a head start. Don’t worry if you don’t recognize any of these things because we will be going over them today!

comments powered by Disqus