Reputation: 1828
I'm trying to define a Javascript function or a simple variable in Chromium Browser debugger console. After definition, when I cannot reach this function. What shall be the problem for it?
Here are the variable and function definition that I write on the chromium console:
var myvar;
var f = function(){
console.log("Hello world");
};
function f2(){
console.log("Hello world");
};
By the way, I can reach the functions that I created at Mozilla Firefox Browser.
What is the problem with Chromium Browser?
Upvotes: 4
Views: 20451
Reputation: 335
You can also write
document.myFunc = function(){alert("Hello");}
Call it with
document.myFunc()
But I'm not an expert
Upvotes: 2
Reputation: 55
You can try this:
function fun(a,b)
{
console.log(a,b);
}
fun(5,6); // calling
Upvotes: 1
Reputation: 2427
function is reserved word in javascript.
Try this
var f = function() {
console.log("Hello world");
};
instead of
var function = f(){
console.log("Hello world");
};
Upvotes: 5