
- HTML Tutorial
- HTML - Home
- HTML - Overview
- HTML - Basic Tags
- HTML - Elements
- HTML - Attributes
- HTML - Formatting
- HTML - Phrase Tags
- HTML - Meta Tags
- HTML - Comments
- HTML - Images
- HTML - Tables
- HTML - Lists
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML - Frames
- HTML - Iframes
- HTML - Blocks
- HTML - Backgrounds
- HTML - Colors
- HTML - Fonts
- HTML - Forms
- HTML - Embed Multimedia
- HTML - Marquees
- HTML - Header
- HTML - Style Sheet
- HTML - Javascript
- HTML - Layouts
- HTML References
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Entities
- HTML - Fonts Ref
- HTML - Events Ref
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
What will happen if a semicolon is misplaced in JavaScript?
If a semicolon is misplaced in JavaScript, then it may lead to misleading results. Let’s see an example, wherein the if statement condition is false, but due to misplaced semi-colon, the value gets printed.
Example
<!DOCTYPE html> <html> <body> <script> var val1 = 10; if (val1 == 15) { document.write("Prints due to misplaced semi-colon: "+val1); } var val2 = 10; if (val2 == 15) { // this won't get printed document.write(val2); } </script> </body> </html>
- Related Articles
- What will happen when { } is converted to String in JavaScript?
- What will happen if garbage is left open in bin?
- What will happen when [50,100] is converted to Number in JavaScript?
- What will happen when [50,100] is converted to Boolean in JavaScript?
- What will happen when 0 is converted to Number in JavaScript?
- What will happen when 1 is converted to Boolean in JavaScript?
- What will happen when ["demo"] is converted to Number in JavaScript?
- If our joints will not move what will happen?
- What will happen if intake of iodine in our diet is low?
- What is reverberation? What will happen if the reverberation time in a big hall is too long?
- What will happen if a saturated solution is : (i) heated, and (ii) cooled ?
- What do you think will happen if prostitution is made legal in India?
- What will happen if a strip of zinc is immersed in a solution of copper sulphate?
- What will happen if there will be no cone cells in our retina?
- What will happen if there are no platelets in the blood?

Advertisements