Skip to main content

Posts

Showing posts from July, 2021

JavaScript Cheatsheet

  JavaScript Cheatsheet Loading... JavaScript Basics Set of JavaScript basic syntax to add, execute and write basic programming paradigms in Javascript  On Page Script Adding internal JavaScript to HTML < script type = " text/javascript " > //JS code goes here </ script > Copy External JS File Adding external JavaScript to HTML < script src = " filename.js " > </ script > Copy Functions JavaScript Function syntax function nameOfFunction ( ) { // function body } Copy DOM Element Changing content of a DOM Element document . getElementById ( "elementID" ) . innerHTML = "Hello World!" ; Copy Output This will print the value of a in JavaScript console console . log ( a ) ; Copy Conditional Statements Conditional statements are used to perform operations based on some conditions. If Statement The block of code to be executed, when the condition specified is true. if ( condition ) { // block of code to be executed if...