11 Concepts That Will Level Up Your JavaScript Skills As a Junior Developer

1.String.trim()

The trim() method removes whitespace from both sides of a string.

var str = “ Hello World! “;
alert(str.trim());

2.String.slice()

The slice() method extracts parts of a string and returns the extracted parts in a new string.

let str = ‘The morning is upon us.’
str.slice(-3) // returns ‘us.’
str.slice(-3, -1) // returns ‘us’
str.slice(0, -1) // returns ‘The morning is upon us’

3.String.toLowerCase()

This function converts a string Character to Lowercase Character.

const sentence = ‘The quick brown fox jumps over the lazy dog.’;
console.log(sentence.toLowerCase());
// expected output: “the quick brown fox jumps over the lazy dog.”

4.String.spilt()

Split a string into an array of substrings:

var str = “How are you doing today?”;
var res = str.split(“ “);

5.Number.parseFloat()

function converts a string to a floating number.

parseFloat(51.12) //51.12

6.Math.random()

This example returns a random integer between the specified values. The value is no lower than min (or the next integer greater than min if min isn't an integer), and is less than (but not equal to) max.

7.Math.round()

The math round function returns the value of a number rounded to the nearest integer.

console.log(Math.round(0.9));
// expected output: 1

console.log(Math.round(5.95), Math.round(5.5), Math.round(5.05));
// expected output: 6 6 5

console.log(Math.round(-5.05), Math.round(-5.5), Math.round(-5.95));
// expected output: -5 -5 -6

example

8.Array.filter() :

when you working with data,u will must need to filter dta.Array.filter do the task for u.

function isBigEnough(value) {
return value >= 10
}

let filtered = [12, 5, 8, 130, 44].filter(isBigEnough)

The following example returns all prime numbers in the array:

9.Array.find()

The find method returns the value of the first element in the provided array that satisfies the provided testing function.

Find an object in an array by one of its properties

const array1 = [5, 12, 8, 130, 44];

const found = array1.find(element => element > 10);

console.log(found);
// expected output: 12

10.Array.Destructuring()

Don’t be thrown off by JavaScript parameter destructuring! It’s a common way to cleanly extract properties from objects.

11.Array.reduce()

Array.reduce method call a reducer function and return a single accumulated value to get an array where duplicate items have been removed.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Nadim Mahmud

Nadim Mahmud

4 Followers

My name is Nadim Mahmud. I am a software developer with extensive knowledge in programming, web development, mobile development, and database design.