Write text with JavaScriptWrite HTML tags with JavaScriptJavaScript in the body sectionJavaScript in the head sectionAn external JavaScript
Examples explained
JavaScript statements.JavaScript blocks.Single line comments.Multiple lines comments.Single line comment to prevent execution.Multiple lines comment to prevent execution.
Declare a variable, assign a value to it, and display it
If statementIf...else statementRandom linkSwitch statement
Alert boxAlert box with line breaksConfirm boxPrompt box
Call a functionFunction with an argumentFunction with an argument 2Function that returns a valueFunction with arguments, that returns a value
For loopLooping through HTML headersWhile loopDo While loopBreak a loopBreak and continue a loopUse a for...in statement to loop through the elements of an array
The try...catch statementThe try...catch statement with a confirm boxThe onerror event
Create a welcome cookieButton animationImage map with added JavaScriptSimple timingAnother simple timingTiming event in an infinite loopTiming event in an infinite loop - with a Stop buttonA clock created with a timing eventCreate a direct instance of an objectCreate an object constructor
Your Query was successfully sent!