I want to pass an index-variable as this
to a function I call with function.call()
.
var fun = function() {
console.log( this );
}
fun.call( 1 );
// -> Number {[[PrimitiveValue]]: 1}
So obviously the primitive integer 1
is not passed as primitive to the called function.
According to MDN for Function.prototype.call() "[...] primitive values will be converted to objects."
Is there a way to pass it to fun()
as primitive integer?