JavaScript Fundamentals

Initially published on 22/06/2015
Press F12 when your Chrome Browser is open. OR Right click and click on Inspect element(All Browsers).At the Lower end of the page, click on console button(next to Audits button).
StringInput your name inbetween inverted commas "" and press enter. > "SACHIN" <- "SACHIN" We will get an output as SACHIN. Try giving the string without quotes > SACHIN We will get an uncaught: ReferenceError String Length To calculate the String length add .length and press enter. > "SACHIN".length <- 6 Math operations Math operations such as addition, subtraction, multiplication and division can be done in console. > 3+5 <- 8 > 7-2 <- 5 > 6*6 <- 36 > 8/4 <- 2 Interactivity Confirm command gives a pop up at the top of the page. > confirm("I have arrived");                            //press enter If you click OK then the output will be <- true Prompt command creates a pop up with a question answer box. > prompt("What is your name ?"); If you key in the answer and press enter we will get an output that was given in the answer box. <- God of Off-Side (* The above exercises are available at codeacademy)

Leave a comment

Please note, comments must be approved before they are published