JavaScript Basic Concept, All You Need To Know
Introduction: JavaScript is a multi-paradigm, dynamic language with types and operators, standard built-in objects, and methods. many structures from those languages apply to JavaScript as well. JavaScript supports object-oriented programming with object prototypes, instead of classes. JavaScript also supports functional programming — because they are objects, functions may be stored in variables and passed around like any other object. Today I’m talking about JavaScript 10 important things, I think it is very helpful for your study.
Javascript String
String.prototype charAt()
The CharAt Method Used For Find Variable Or Any Others Index Place,
If the Index cannot be converted to the integer or no Index is provided, the default is 0, so the first character of str is returned.
Code Example 👇
String.prototype Concat()
The method used for adding two or more than string variables with spacing, or not spacing, as your wish.
Code Example 👇
String.prototype includes()
The includes() method determines whether an array includes a certain value among its entries, returning true or false as appropriate.
Code Example 👇
String prototype endsWith()
The endsWith() method determines whether a string ends with the characters of a specified string, returning true or false as appropriate.
Code Example 👇
String.prototype indexOf()
The indexOf() method returns the index within the calling string object of the first occurrence of the specified value, starting the search at FromIndex. Returns -1 if the value is not found
String prototype lastIndexOf()
Javascript Number
isNaN()
The isNaN() function determines whether a value is NaN or not.
parseInt()
The parseInt() function parses a string argument and returns an integer of the specified (the base in mathematical numeral systems).
parseFloat()
The parseFloat()
function parses an argument (converting it to a string first if needed) and returns a floating-point number.
JavaScript Array
Array prototype filter()
The filter() method creates a new array with all elements that pass the test implemented by the provided function
Array.prototype.find()
The find() method returns the value of the first element in the provided array that satisfies the provided testing function. If no values satisfy the testing function, undefined is returned.
JavaScript Math
Math.abs()
The Math. abs() function returns the absolute value of a number. That is, it returns X if X is positive or zero, and the negation of x if x is negative.
Math.ceil()
The Math. ceil() function always rounds a number up to the next largest integer.
Note: Math. ceil(null) returns integer 0 and does not give a NaN error.