Fact Check 5

Atlanta Mayor Keisha Lance Bottoms (D) suggested that the GOP is using the Chinese coronavirus pandemic to “spread misinformation and interfere with voting,” forcing many to “risk their lives” to…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Inside the JavaScript

JavaScript is the scripting language for web pages. In 1995 an engineer from Netscape Brendan Eich created it. It passes objects in which functions are stored in variables. In other words, JavaScript supports functional programming and object-oriented programing.

Let’s know some basic functionality of JavaScript:

1.String.prototype.trim()

In JavaScript for representing a sequence of data, we use a string object. The content is enclosed by a double invited comma sign (“ “). But the problem is JS counts the white space as a character. For avoiding this circumstance we use the trim() method.

const wave = “ HI there! “;

console.log(wave) ; // “ HI there! “

console.log(wave.trim()); // “HI there!“

2.String.prototype.toLowerCase()

For making a sting’s all character into lower case we we toLowerCase() method.

const word = “ABCDEF”;

console.log(word.toLowerCase()); //abcdef

3.String.prototype.charAt()

By using charAt() method we can specify character at a certain index.

const location = “I am a learner”;

const i = 3;

console.log(‘Character at index ${i} is ${location.charAt(i)}); // Character at index 3 is m

#N.B. JavaScript counts white space as an character.

4.String.prototype.substr()

With the help of the substr() method, we get a portion of a part of the string. It starts with a specific index and returns characters until the next given number.

const portion = “Programming”

console.log(portion.substr(2,5)); //ogra

console.log(portion.substr(7)); //ming

5.Math.abs()

For returning the absolute value of a number we use math.abs() function.

Math.abs(‘-1’); //1

#N.B. — It returns NaN for string or an empty variable.

6.Math.sqrt()

Math.sqrt() function is an interesting function in the built-in Math object. It returns the user the square root of the given number.

Math.sqrt(9); // 3

#N.B. — It returns NaN for negative numbers.

7.Array.prototype.map()

It creates an impact on each and every element of an array.

const arr = [5, 10, 15, 20];

const mapping = arr.map(x => x * 5);

console.log(mapping); //[25, 50, 75, 100]

8.Array.prototype.sort()

sort() method convert a un sorted array in ascending order.

const num = [5, 3, 1, 4, 2];

num.sort();

console.log(num); // [1, 2, 3, 4, 5]

9.Array.prototype.every()

In the boolean data type value, every() method tests all the elements of the given array satisfied the condition given by the user.

const above = (curval) => curval < 5;

const ary = [1, 3, 2];

console.log(ary.every(above)); //true

10.SSL

SSL is the short form of “Secure Sockets Layer”. It works as a safe pipeline for passing data between server and browser to remain private.

Add a comment

Related posts:

My Social Self

Our social self relies on interactions with people. taking part in school activities helped me to enhance my social self and spending my time with my closest friends helped me to become more…

9 Learnings From My Last Month

Everyone has a lot of wisdom within themselves, but that doesn’t mean that we all have to unload that wisdom to one another at once. And we certainly don’t need to. One of the noblest things or…