pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/Hyuk/javascript/blob/master/javascript-basics/javascript-basics/basics.md

lobal-68dd150ce6c8e711.css" /> javascript/javascript-basics/javascript-basics/basics.md at master · Hyuk/javascript · GitHub
Skip to content

Latest commit

 

History

History
75 lines (65 loc) · 1.33 KB

File metadata and controls

75 lines (65 loc) · 1.33 KB

Basics

  • in-line comment
  • multi-line comment
  • inline javascript in html
  • external javascript file in html

in-line comment

// this is an in-line comment

multi-line comment

/* this is a
multi-line comment */

how to use javascript in HTML file - inline

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script type="text/javascript">
    console.log('JavaScript');
  </script>
</body>
</html>

how to use javascript in HTML file - external file

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script src="http://code.jquery.com/jquery.js"></script>
</body>
</html>

Semi Colon at the end of javascript code

  • The semicolon can be omitted but it has to be at the end of the javascript code
console.log('JavaScript');

Code can be written in multipleline

console
.
log
(
  'Hello World'
);

// Hello World

Code can't be written in multipleline

break, continue, throw, ++, --

Code can be one line

console.log('smart'); consol.log('Hello World');
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy