JavaScript Journey : 11 Things You Can Try In Day One

Shahin Mahmud
2 min readApr 27, 2020

--

String

replace()

The replace() method returns a new string with some or all matches of a pattern replaced by a replacement.

Example:

String.prototype.replace()

slice()

The slice() method extracts a section of a string and returns it as a new string, without modifying the original string.

Example:

String.prototype.slice()

split()

The split() method divides a String into an ordered set of substrings, puts these substrings into an array, and returns the array.

Example:

String.prototype.split()

Number

isNaN() & Number.isNaN()

  • The isNaN() method determines whether the passed value is NaN(Not a Number) and its type is Number.
  • In comparison between global isNaN() and Number.isNaN(), isNaN() is forcefully converting the parameter to a number where Number.isNaN() is normally converting the parameter.

Example:

Number.isNaN()

parseInt()

The parseInt() method parses a string argument and returns an integer of the specified base.Default is decimal.

Example:

Number.parseInt()

Array

reduce()

The reduce() method executes a reducer function (that provide) on each element of the array, resulting in a single output value.

Example:

Array.reduce()

Object

Object.create()

The Object.create() method creates a new object, using an existing object as the prototype of the newly created object.

Example:

Object.create()

Object.assign()

Object.assign() method used to copy the values and properties from one or more source objects to a target object.Simply [[Get]] on the source and [[Set]] on the target.

Example:

Object.assign()

Object.freeze()

Object.freeze() method is used to freeze an object or arrays. Freezing an object does not allow new properties to be added to an object and prevents from removing or altering the existing properties.

Example:

Object.freeze()

Object.seal()

Object.seal() method is used to seal an object. Sealing an object does not allow adding new properties and marks all existing properties as non-configurable and values of present properties can be change.

Example:

Object.seal()

Math

Math.abs()

The Math.abs() function in JavaScript is used to return the absolute value of a number. It takes a number as its parameter and returns its absolute value.

console.log(Math.abs(-4));//Output : 4

That’s it for today. Keep reading next 11

--

--

Shahin Mahmud

Like to self develop day by day. Don’t like to miss a single day.