I’m new to java script i have small problem this little code it’s not working
it’s regarding object and function
var person = {
firstName : "kevin",
lastName : "sandigo"}
function getFullName() {
return this.firstName + " " + this.lastName;
}
alert(person.getFullName());
You should pass your object into the function, and use that argument to access its properties:
If you want to create a class that you can re-use, you’ll have to declare the function on the
prototype: