JSFiddle

  • Value Returning Functions

    EasyProgramming.net tutorial on Value Returning Functions

    var loan = 100;
    var interest = 0.05;
    
    console.log(total(loan,interest));
    console.log(total(200,0.03));
    console.log ...
  • Intro to Event Listener

    EasyProgramming.net tutorial on Event Listeners!

    document.getElementById("name").addEventListener("click",function(){
    	alert("I have been clicked");
    });
    
    document.getElementById("name").addEventListener("click",function(){
    	var btnName = this ...
  • Intro to Custom JavaScript Functions

    Learn how to write your own functions in this tutorial provided by EasyProgramming.net

    var loan = 100;
    var interest = 0.05;
    
    //var addInterest = function(x,y){
    //	var calculated = x + (x * y);
    //  console.log(calculated ...
  • Value Returning Functions #35 is the latest revision

    EasyProgramming.net tutorial on value returning functions

    var loan = 100;
    var interest = 0.05;
    
    (function(x,y){
    	var calculated = x + (x * y);
    	document.getElementById("total").innerHTML = calculated ...
  • Looping with the Array.forEach method

    EasyProgramming.net tutorial on the array.forEach method

    //iterate through each array item with forEach
    
    var myArray = ['Boston','New York','Chicago','Miami','Los Angeles','Dallas','Seattle'];
    
    myArray.forEach ...
  • Do While Loop in JavaScript

    EasyProgramming.net tutorial on the do while loop

    //set the value of 'i' to 0; execute code once and then check the condition, continue if met
    
    var i ...
  • The 'while' loop

    Learn about the 'while' loop in the 24th Easy JavaScript tutorial, part of EasyProgramming.net

    //set the value of 'i' to 0; loop while 'i' is less than 10; increment 'i' by 1 every time ...
  • Ternary Operator Tutorial

    EasyProgramming.net tutorial #22 - ternary operator

    var price = 3;
    
    (price == 1) ? console.log("one") : (price == 2) ? console.log("two") : console.log("it's neither");
    
    var color ...
  • Easy JavaScript - Switch Statements

    EasyProgramming.net Tutorial on Switch Statements

    var button = document.getElementById("submit");
    
    button.onclick = function(){
    
    	var item = document.getElementById("item").value;
    
    	var price; 
      
      switch(item){
      	case "shirt ...
  • if...else statements

    EasyProgramming.net tutorial on conditions - the if...else statement

    var price = 1;
    
    if(price < 10){
    		console.log("It costs less than $10 so it must be cheap");
    } else if(price >= 10 && price < 100){
    		console.log("It costs between $10 and $100 so it must be of good value");
    } else {
    		console.log("It seems too expensive");
    }
    
    var color = 'red';
    var output = document.getElementById ...