Reputation: 2457
I am trying to get the function in a function with argument inside the child function
function firstF (){
this.childF1 = function($argument){
// do something + $argument
}
this.childF2 = function($argument2){
// do something + $argument2
}
}
//Declare a new firstF
var firstFunction = new firstF();
firstFunction.childF1
how do i declare the $argument here?
Upvotes: 1
Views: 96
Reputation: 707158
You do it like this:
var firstFunction = new firstF();
firstFunction.childF1(arghere)
childF1
is a property of your firstF
object and that property is a function. So, you call it like a function with parens and you pass the arguments in the parens. You must call it on an already created object of type firstF
, not on the firstF
function itself.
Upvotes: 2