JavaScript Selection Statement Creating Array window.setInterval(expression/function, time)
Selection Statement Selection or conditional statements perform different actions based on different conditions If Statement Syntax if( condition ) Statement Semantics Evaluate the condition (true or false) If the condition is true True: DO STATEMENT False: SKIP the STATEMENT
Selection Statement Syntax: if…else if(condition){ }else { } if the condition is true, the code in here is executed }else { if the code is false, the code in here is executed }
Creating Array Array object stores a list of values Each value is an element of the Array and has an associated index Create array with initial values var arrayName = new Array(elment0, element1, element2, etc);
Creating Array Create array with size defined var arrayName = new Array(3); arrayName[0] = value; arrayName[1] = value; arrayName[2] = value;
SetInterval JavaScript execution in response to timer event Write up the code you would like executed multiple time at regular interval Use the setInterval of the window class Syntax: window.setInterval(expression/function , time in millisecond);