Front End Programmer Question:
Explain how to use a function a Class?
Answer:
function functionName(name) {
this.name = name;
}
// Creating an object
var functionName = new functionName("WTEN");
console.log(functionName.name); //WTEN
this.name = name;
}
// Creating an object
var functionName = new functionName("WTEN");
console.log(functionName.name); //WTEN
Previous Question | Next Question |
Tell me how do you clear a floated element? | Tell me how would you call a function directly on a string? |