Javascript Fundamental Core Concepts.

Sajjad Sadiq
2 min readMay 6, 2021

--

01. “Primitive”

The JavaScript syntax defines two types of values: (Fixed values are called Literals, Variable values are called Variables).

A Primitive (primitive value, primitive data type)There are 7 primitive data types, console and print these primitive values using console.log():Number,String,bigint,boolean,Undefined,Symbol, and Null.

Most of the time, a primitive value is represented directly at the lowest level of the language implementation. Objects and Functions​ are also valued in the browser console:

For example:

console.log(23); // Number 
console.log(sajjad); // String
console.log(undefiend); // Undefiend

02. “Expressions”

An expression is a combination of values Since expressions produce values, variables, and operators, which computes a value the arguments of a function invocation. expressions and operators, including assignment,comparison,arithmetic,bitwise,logical,string and more.

The computation is called an evaluation.

For example,

console.log(10 * 12); //evaluates to 120
console.lgo("Sajjad" + " " + "Sajjad"); //evaluates to "Sajjad Sadiq":

Notes: ​Expressions always result in a single value(6 + 9, and it answers with 15).​

JavaScript var keyword tells the browser to create variables:

var a, b;
a = 5 + 6;
b= a* 10;

03. “Object and Functions”

The Object a class represents one of JavaScript's data types and designed on a simple object-based paradigm.

An object is a collection of properties, The Object a constructor creates an object wrapper for the given value.

For example,

var jsLanguage = {
language: 'Javascript',
author: 'Brendan Eich',
year: 1995
};

04. “Error handling, try…catch”

The try...catch the statement marks a block of statements Throw and Try to Catch. sometimes our scripts have errors

But there’s a syntax construct statements try and catchand “catch” errors printing it to console

Syntax:

try {
// code to try.......
}
catch(err) {
// code to handle errors
}

05. “Coding Style”

hello programmers! your code clean and easy to read as possible. curly braces are written code both correct and human-readable and A good code style greatly assist in that😏( Curly Braces ,Line Length ,Indent ,Symicolons and more)

if (condition) {   
// do this code
// and that
// more code
}

06. “Comments”

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

The main purpose of writing code we write is also easily interpretable by fellow developers. comments can be single-line: starting with // and multiline: /* ... */.

// Write a code explanatoryeasy to developersvar one = 8;      // Declare one, give it the value of 8
var two = one + 3; // Declare two, give it the value of one + 3

--

--

Sajjad Sadiq
Sajjad Sadiq

No responses yet