What is JavaScript?

rsl mzdr
3 min readNov 1, 2020
what is javaScript?

javaScript is the world’s most misunderstood programming language. It is often derided as being a toy, but beneath its layer of deceptive simplicity, powerful language features await. JavaScript is now used by an incredible number of high-profile applications, showing that deeper knowledge of this technology is an important skill for any web or mobile developer.

JavaScript was created by ‘‘ Brendan Eich’’ in 1995.

  • JavaScript was initially created as a browser-only language, but it is now used in many other environments as well.
  • Today, JavaScript has a unique position as the most widely-adopted browser language with full integration in HTML/CSS.
  • There are many languages that get “transpired” to JavaScript and provide certain features. It is recommended to take a look at them, at least briefly, after mastering JavaScript.

1. String.prototype.charAt()

The charAt() method returns the character at the specified index in a string.The index of the first character is 0, the second character is 1, and so on.

for Example :

const anyString = 'Dhaka is a capital of Bangladesh';
const index = 12;
console.log(`The character at index ${index} is ${anyString .charAt(index)}`);// expected output: "The character at index 12 is a"

2. String.prototype.concat()

The concat() method is used to join two or more strings.

for Example :

const fristName = 'Neaz';
const lastName = 'Mozumder';
const fullName = (fristName.concat(" ",lastName));
console.log(fullName);// expected output: "Hello World"

3. String.prototype.includes()

The includes() method determines whether a string contains the characters of a specified string.This method returns true if the string contains the characters, and false if not.

for Example :

const string = 'i am a student of programming hero.';
const word = 'am';
console.log(string.includes(word));
// expected output: true

4. String.prototype.endsWith()

The endsWith() method determines whether a string ends with the characters of a specified string.This method returns true if the string ends with the characters, and false if not.

for Example :

const string = 'dhaka is a capital of banglades';console.log(string.endsWith("banglades"));
// expected output: true

5. String.prototype.indexOf()

The indexOf() method returns the position of the first occurrence of a specified value in a string.This method returns -1 if the value to search for never occurs.

for Example :

const string = "Bangladesh is my motherland.";
const newString = string.indexOf("my");
console.log(newString);
// expected output: "The index of the first "my" from the beginning is 14"

6. Array.prototype.map()

The map() method creates a new typed array with the results of calling a provided function on every element in this typed array. This method has the same algorithm as

for Example :

const num = [4, 9, 16, 25];
const newNum = num.map(Math.sqrt);
console.log(newNum);
// expected output: Array [2, 3, 4, 5]

7. Array.prototype.unshift()

The unshift() method adds new items to the beginning of an array, and returns the new length.

for Example :

const num = [7,8,9,10,11,12];console.log(num.unshift(13, 14));
// expected output: 5
console.log(num);
// expected output: Array [4, 5, 1, 2, 3]

8. Array.prototype.filter()

The filter() method creates a new array with all elements that pass the test implemented by the provided function.

for Example :

const ages =[ 30, 32,34,35,40,45,21,13,15,17,25];
const older = ages.filter((age)=> {
return age > 25;
})
console.log(older);
// expected output:Array [30, 32, 34, 35, 40, 45]

9. Array.prototype.splice()

The splice() method changes the contents of an array by removing or replacing existing elements and/or adding new elements in place.

for Example :

const nums = [100, 200, 300, 400,500,600,];
nums.splice (1, 0, 'add');
console.log(nums);
// expected output: Array [100, "add", 200, 300, 400, 500, 600]

10. Array.prototype.reverse()

The reverse() method reverses the order of the elements in an array.

for Example :

const nums = [1,2,3,4,5,6,7,8,9,10];
const reversed = nums.reverse();
console.log('reversed:', reversed);
// expected output: Array [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]

--

--