An Interest In:
Web News this Week
- March 25, 2025
- March 24, 2025
- March 23, 2025
- March 22, 2025
- March 21, 2025
- March 20, 2025
- March 19, 2025
Javascript for Absolute Beginners 01
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 dynamic programming language. 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 variable.
let apple = "This is a lowercase apple";let Apple = "This is an uppercase apple";console.log(apple)> This is a lowercase appleconsole.log(Apple)> This is an uppercase apple
Identifiers
The identifier is the name given to a variable, function, parameter, or class by the programmer who wrote that program.
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
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:
// 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 syntax errors after minifying javascript code.
Expressions
An expression is a block of code that evaluated to a value.
- Arithmetic expressions - Ex. 2 + 3
- String expressions - Ex. 'sagar' + 'sinha'
- Primary expressions - Ex. true, false
- Array and object initializers expressions - Ex.[], {}
- Logical expressions - Ex. &&, ||
- Left-hand-side expressions - Ex. new, super
- Property access expressions - Ex. object.property
- Object creation expressions - Ex. new object()
- Function definition expressions - Ex. function() {}
- Invocation expressions - Ex. f(0)
Cheers! See you again in the next article.
Original Link: https://dev.to/sinhasagar01/javascript-for-absolute-beginners-01-g52

Dev To

More About this Source Visit Dev To