JavaScript Tutorial
3.65K subscribers
302 photos
17 links
🕹 JavaScript is the 
Programming Language 
for the Web.

🕹 JavaScript can update
and change both 
HTML and CSS.

🕹 JavaScript can calculate, 
manipulate and 
validate data.

Group
@js_group_tut

@javascript_tut
Download Telegram
Channel created
🕹 JavaScript is the 
Programming Language 
for the Web.

🕹 JavaScript can update
and change both 
HTML and CSS.

🕹 JavaScript can calculate, 
manipulate and 
validate data.

@javascript_tut
"w3schools .com"
JavaScript, often abbreviated as JS,

is a programming language conforms to the ECMAScript specification.

JavaScript is high-level, often just-in-time compiled, and multi-paradigm.

It has curly-bracket syntax, dynamic typing, prototype-based object-orientation, and first-class functions. 


@javascript_tut
"Wikipedia"
💻 JavaScript Variables

JavaScript variables are containers for storing data values.

📌 In this example, x, y,
and z, are variables:

📎 Example:
------------------------------
var x = 5;
var y = 6;
var z = x + y;
------------------------------

@javascript_tut
"w3schools .com"
📎 Type Syntax

A variable must be declared before it is used. ES5 (JavaScript 5) syntax used the var keyword to achieve the same. The ES5 syntax for declaring a variable is as follows.

📎 Example:
------------------------------
var x = 5;
var y = 6;
var z = x + y;
------------------------------

ES6 (JavaScript 6) introduces the following variable declaration syntax −

📌 Using the let
📌 Using the const

📎 Example:
------------------------------
let x = 5;
const y = 6;
const z = x + y;
------------------------------

@javascript_tut
"Tutorialpoint"
ES 6 (JavaScript 6)
JavaScript Variables & Data Types
#1. JavaScript Numbers
JavaScript has only one type of number. Numbers can be written with or without decimals.


#2. JavaScript Strings
Strings store text. Strings are written inside quotes. You can use single or double quotes:


#3. JavaScript Objects
You have already learned that JavaScript variables are containers for data values.

Objects are variables too. But objects can contain many values.

#4. JavaScript Arrays
JavaScript arrays are used to store multiple values in a single variable.


#6. JavaScript Functions
A JavaScript function is a block of code designed to perform a particular task.

A JavaScript function is executed when "something" invokes it (calls it).

@javascript_tut
"w3schools .com"
📌 JavaScript Output

JavaScript can "display" data in different ways:

#1 Using innerHTML
Writing into an HTML element

#2 Using document.write()
Writing into the HTML output

#3 Using alert()
Writing into an alert box

#4 Using console.log()
Writing into the browser console

@javascript_tut
"w3schools .com"
📕Example: for #innerHTML
-----------------------------------

<!DOCTYPE html>
<html>
<body>
<p id="demo"></p>

<script>
const txt = "Hello, World";

document.getElementById("demo").innerHTML = txt;

</script>
</body>
</html>

@javascript_tut
📕Example: for #document.write()
-----------------------------------

<!DOCTYPE html>
<html>
<body>


<script>
var txt = "Hello, World";

document.write(txt);
</script>
</body>
</html>

@javascript_tut
📕Example: for #alert()
-----------------------------------

<!DOCTYPE html>
<html>
<body>
Hello

<script>
var txt = "Hello";

alert(txt);
</script>
</body>
</html>

@javascript_tut
📕Example: for #console.log()
-----------------------------------

<!DOCTYPE html>
<html>
<body>


<script>
console.log("GeeksforGeeks");
</script>
</body>
</html>

@javascript_tut
JavaScript Arrays

JavaScript arrays are used to store multiple values in a single variable.

What is an Array?

📌An array is a special variable, which can hold more than one value at a time.

If you have a list of items (a list of car names, for example), storing the cars in single variables could look like this:

----------------------------
var car1 = "Saab";
var car2 = "Volvo";
var car3 = "BMW";
----------------------------

However, what if you want to loop through the cars and find a specific one? And what if you had not 3 cars, but 300?

The solution is an array!

📌An array can hold many values under a single name, and you can access the values by referring to an index number.

@javascript_tut
"w3schools .com"
Creating an Array

📌Using an array literal is the easiest way to create a JavaScript Array.

Example:
-----------------------------
var cars = [
  "Saab",
  "Volvo",
  "BMW"
];
-----------------------------

📌Using the JavaScript Keyword new

The following example also creates an Array, and assigns values to it:

-----------------------------
var cars = new Array("Saab", "Volvo", "BMW");
-----------------------------

The two examples above do exactly the same. There is no need to use new Array().
For simplicity, readability and execution speed, use the first one (the array literal method).


@javascript_tut
"w3schools .com"
JavaScript Comments

📌JavaScript comments can be used to explain JavaScript code, and to make it more readable.

JavaScript comments can also be used to prevent execution, when testing alternative code.

💎Single Line Comments

Single line comments start with //.

Any text between // and the end of the line will be ignored by JavaScript (will not be executed).

💎Multi-line Comments

Multi-line comments start with /* and end with */.

Any text between /* and */ will be ignored by JavaScript.


@javascript_tut
"w3schools .com"
📌Tutorials based on web development and programming.
💻 + Source Code

⚙️ Html, CSS, JavaScript, React , Bootstrap, jQuery, AJAX, PHP, java, Python, SQL, MYSQL, Node.js, JSON, and More...

💙 Subscribe for More Tutorials:
https://www.youtube.com/codingwithelias?sub_confirmation=1
JavaScript Syntax

💎JavaScript syntax is the set of rules, how JavaScript programs are constructed:

📌JavaScript Values

The JavaScript syntax defines two types of values:

💎Fixed values are called Literals.
JavaScript Literals

The two most important syntax rules for fixed values are:

1. Numbers are written with or without decimals:

2. Strings are text, written within double or single quotes:

💎Variable values are called Variables.

In a programming language, variables are used to store data values.

JavaScript uses the var keyword to declare variables.

An equal sign is used to assign values to variables.


@javascript_tut
"w3schools .com"
JavaScript Operators

JavaScript uses arithmetic operators ( + - * / ) to compute values:

JavaScript uses an assignment operator ( = ) to assign values to variables:

@javascript_tut
"w3schools .com"