The call() function is a predefined JavaScript function. The call() allows for a function belonging to object can use a method belonging to another object.

var person = {
fullName: function() {
return this.firstName + " " + this.lastName;
}
}
var person1 = {
firstName:"rahul",
lastName: "gupta"
}
var person2 = {
firstName:"ajay",
lastName: "sharma"
}
person.fullName.call(person1); // Will return "rahul gupta"

This example calls the fullName function of person.

call() method provides a new value of this. Through call() method, you can write a function once and then inherit it in another object, without having to rewrite the function for the new object.

Originally published at https://computerstrick.com.


In this tutorial, we are going to learn about how to remove the first n characters of a string in JavaScript.

Consider, we have the following string:

Now, we want to remove the first 2 characters vol from the above string.

Removing the first 2 characters

To remove the first n characters of a string in JavaScript, we can use the built-in slice() method by passing the n as an argument.

n is the number of characters we need to remove from a string.

Here is an example, that removes the first 3 characters from the following string.

const char…

Okay, so when I say Server Side rendering, I also mean quite a few things related to it. For instance, NodeJS and webpack.

You obviously wouldn’t bother rendering your react app server-side as a beginner when you’re still figuring out how react works and it’s fine. All I’m saying is, you should at least have an idea about what it is and why it is important, so that when you go for your next internship and their server side rendering their app, you are not clueless.

If you are reading about server-side rendering, you’d also come across some server side…

deepak chandra

I am a developer and designer from India🇮🇳. I have a passion for programming and designing. I'd call myself a Jack of all trades but master of none.

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