JavaScript For Beginner (JS Tutorial)

Some Words Of JavaScript………

Shapan Miah
3 min readMay 5, 2021

JavaScript is a scripting or programming language that allows you to implement complex features on web pages. It’s enables you to create dynamically updating content, control multimedia, animation, and nice more everything else.

Photo by Alex Kotliarskyi on Unsplash

JavaScript Types:

Numbers, String, Boolean, Object, Function, Array, Null, Undefined.

I will explain all types shortly, Lets start………….

1, Numbers:

Numbers type is means it’s a representation of an integer using a number value.

Roles of write number type variable:

var price = 50; // console.log(typeof price); // number 50

2, String:

A string data type is traditionally a sequence of characters, either as a literal constant or as some kind of variable. String is generally considered a data type and is often implemented as an array data structure of words that stores a sequence of elements, typically characters, using some character encoding.

Roles of write string type variable:

var name = “karim uddin” // console.log(name); // karim uddin

3, Boolean:

Boolean types value is true and false. both keywords are can be converted to a boolean according to the value:

Roles of write boolean type variable:

var name = karim // console.log(name); // false, var name = “karim” // console.log(name); // true

var price = “45” // console.log(price); // false, var price= 45 // console.log(price); // true

4, Object:

In JavaScript objects are importance and main things. Objects can be reflection of as simple collections of name value or number value or any kind of value etc.

This type are called object:

Numbers, Strings, Booleans, Dates, Maths, Regex, Arrays, Function

Roles of object decleartion:

var person = {name: ”karim”, age: 45, sellary: 20000, home: “dhaka”};

5, Function:

Function is composed of a sequence of statements called the function body. Values can be passed to a function, and the function will return a value.

Roles of function declaration:

JavaScript functions are defined with the function keyword

function calculate(a, b){var total = a * b; // return total};

var newResult= calculate(5, 9);

6, Array:

Arrays are actually a special type of object. They work very much like regular objects numerical properties can naturally be accessed only using syntax but they have one magic property called ‘length’. This is always one more than the highest index in the array.

var friends = [“robin”, “karim”, “rahim”, “jamal”]

friends.length // 4

7, Null, Undefine:

null and undefine all become falsy value provide.

1, Null provide missing value using for coder choice mainly.

var price = null; // null

2, Undefine provide missing value without plan purpose.

var price = “50”; // undefine

Variables

Variables are declared using one of three keywords…… var, const & let.

1, var keyword keyword declare variables this value is available from globally and it access in function and outside.

var eggPrice = 45; // console.log(eggPrice); // 45

2, let keyword keyword declare variables this value is available from complex limit accessable. It is not available outside the block.

let appelPrice = 100; // console.log(applePrice); // 100

3, const keyword declare variables this value are never change and this variable is available from the block it’s declared in. It’s not available outside the block.

const orangePrice = 90; // console.log(applePrice); // 90

JavaScript is a multi-pattern and dynamic language with some types and operators.

Explore Math.round()

Math.round is give a close integer number.

Code below….

console.log(math.round(9.5556)); // output is 10;

console.log(math.round(9.9999)); // output is 10;

console.log(math.ceil(9.49999)); // output is 9;

Explore Math.ceil()

Math.ceil is rounds a number and give up immediate lowest number & output to the immediate largest number. It’s don’t give the error or NaN.

Code below….

console.log(math.ceil(9.5)); // output is 10;

console.log(math.ceil(9.9999)); // output is 10;

console.log(math.ceil(9.00001)); // output is 10;

Explore Math.floor()

Math.floor is rounds a number and give up immediate hightest number And give output to the immediate lowest number. It’s don’t give the error or NaN.

Code below….

console.log(math.floor(9.5)); // output is 9;

console.log(math.ceil(9.9999)); // output is 9;

console.log(math.ceil(9.00001)); // output is 9;

--

--