Javascript for Absolute Beginners #01
Tags: javascript, beginners, webdev
Published: 2020-08-12 22:14:43

<mark> Note: I will put reference links or explain the Jargons used in this article at the bottom of the article.</mark>

----

>**This is my first article for absolute beginners who wanted to learn Javascript from scratch, in these articles I will try to cover every tiny bit of javascript.**

----
##**What is Javascript?**##

Javascript is a <mark>dynamic programming language</mark>.<sup>1</sup> Javascript enables interactivity in Web pages.

----
##**Javascript Syntax**##

- Case Sensitive
- Identifiers
- Comments
- Statements
- Expressions

----

##**Case Sensitive**##

Javascript is a case-sensitive language. It means **apple** & **Apple** is not the same <mark>variable</mark>.<sup>2</sup>

```javascript
let apple = "This is a lowercase apple";
let Apple = "This is an uppercase apple";

console.log(apple)
> This is a lowercase apple
console.log(Apple)
> This is an uppercase apple
```

----

##**Identifiers**##

The identifier is the name given to a variable, <mark>function</mark><sup>3</sup>, <mark>parameter</mark><sup>4</sup> by the programmer who wrote that program.

```javascript
let varName = "This is an identifier";

// In the above example, varName is the Identifier
```

Rules for writing an identifier name.
- The first character of the identifier name must start with a letter (a-z, A-Z) / (_ underscore) / ($ dollar sign)  
- The other character of the identifier name can be a letter (a-z, A-Z) / (0-9) / (_ underscore) / ($ dollar sign).
- JavaScript defines a list of keywords that have special uses. You cannot use the keywords as the identifiers. 
[See Full List of keywords](https://www.w3schools.com/js/js_reserved.asp)

----

##**Comments**##

Comments are common practice in all programming languages for leaving notes or explaining your code to yourself and others.

There are two kinds of comments in javascript.

- Single-line comment
- Multi-line comment or Block comment

Example: 

```javascript
// this is a single-line comment


/*
* This is a block comment that can
* span multiple lines
*/
```

----

##**Statements**##

Statements are a sequence of commands that needs to be executed. Statements should end with a semicolon(;), strongly recommended but not required.

> Semicolon(;) is required for the readability of the code and also to avoid <mark>syntax errors</mark><sup>5</sup> after <mark>minifying</mark><sup>6</sup> javascript code.

----

##**Expressions**##


An expression is a block of code that evaluated to a value.

Below are the types of Expressions in Javascript. I will explain these in the next article.

1. Arithmetic expressions - Ex. 2 + 3
2. String expressions - Ex. 'sagar' + 'sinha'
3. Primary expressions - Ex. true, false
4. Array and object initializers expressions - Ex.[], {}
5. Logical expressions - Ex. &&, ||
6. Left-hand-side expressions - Ex. new, super
7. Property access expressions - Ex. object.property
8. Object creation expressions - Ex. new object()
9. Function definition expressions - Ex. function() {}
10. Invocation expressions - Ex. f(0)


Cheers! See you again in the next article. (Next article will be about expressions in detail.)

##**Jargons Explained**##

1. **Dynamic programming language** - In computer science, a dynamic programming language is a class of high-level programming languages, which at runtime execute many common programming behaviors that static programming languages perform during compilation. Source - Wikipedia

Related Links for more informatiion - [mdn](https://developer.mozilla.org/en-US/docs/Glossary/Dynamic_programming_language) , [wikipedia] (https://en.wikipedia.org/wiki/Dynamic_programming_language) , [sitepoint](https://www.sitepoint.com/typing-versus-dynamic-typing/)

2. **Variable** - Variables are named reference to a value. Further details on the variables in the coming articles.

3. **Function** - A function is a block of statements that are used to perform a specific task. Further details on the variables in the coming articles.


4. **Parameter** - Will learn in detail in an upcoming article.

5. **Syntax errors** - An incorrect use of pre-defined syntax cause a syntax error. For example, if you leave off a closing brace (}) when defining a JavaScript function, you trigger a syntax error.

6. **Minifying** - Minifying the code means removing whitespaces, comments, and other unnecessary stuff that is not needed for the execution of the code. This process is used for reducing the file size.

If you guys have any doubt or anything you haven't understood, please feel free to ask in the comment.