JavaScript #1 - <Script>

mrmobin

Mobin

Posted on July 28, 2022

JavaScript #1 - <Script>

Welcome!
This is first tutorial. hope you enjoy :)

+------------------------------------------+

Where we code JS?

For coding JS you have different ways ; But follow these , step by step.

  1. First You need a IDE

IDEs means Integrated Development Enviroment , they are diffrent programs that you can write your code in them .

What IDE is Appropriate for JS

They are diffrent IDEs But i tell you bests :

  1. VS Code
  2. phpStorm - I prefer
  3. Atom

First Code

well, when you download one of them , open it. First create a folder , then in the folder create a HTML file . (it must be like this : "example.html" or "Index.html") .
Then go in file .
It must be like it:

Image description
if it isn't like it , write these codes in it

Hi HTML
You can code JS in 'body' and 'head' but there are diffrent to use :

When you write JS in 'head' , First JS code will run and it
make your loading speed site ,slow . So i prefer to write JS in 'body'.

Now, you need to create a space to write your JS codes . At First we write our codes in HTML documents but after a few days , we
learn how to write JS in spacial file (like index.js).
well , you must to write in 'body' Tag. It must like this:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title> JS - Script </title>
</head>
<body>

<script>

</script>

</body>
</html>

Enter fullscreen mode Exit fullscreen mode

Now we write a example code into 'script':

alert('Hello World')
Enter fullscreen mode Exit fullscreen mode

How to run codes?

well , you have different ways, for example in phpstorm you can click on google/firefox or.. icons and it will run your code in them.
but in other IDEs you must to find your file with .html format and double click on it.

Image description
Did you see alert of browser? :)

Go and learn HTML&CSS

if you don't know HTML or Css first learn them , then come back here because you need to code some html & css in these tutorials .
and today's tutorial is finished.

hope you enjoyed :) <3

💖 💪 🙅 🚩
mrmobin
Mobin

Posted on July 28, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related