- 31.3k
- 22
- 110
- 134
Yes its, it's possible, and it will not create a global function. I verified this in IE6Internet Explorer 6, FFFirefox, Chrome, Operaand Opera. Consider the following code:
<head>
<title>Never called again</title>
<style type="text/css">
</style>
<script type="text/javascript">
function hello() {
function never_called_again(args) {
alert("Hello world " + never_called_again);
//do some stuff
never_called_again = function (new_args) {
//do some new stuff
alert("hello " + never_called_again);
}
}
never_called_again();
never_called_again();
}
</script>
</head>
<body onload="">
<button onclick="hello(); never_called_again();">Call</button>
</body>
This will print "Hello World {function code}" the first time of the never_called_again and the second time it will print "hello {changed function code}" the second time.
But when itsit's being called on button's onclick, it will throw an error saying that the function is not defined, clearly indicating that the function was re-defined (and not created globally).
Yes its possible and it will not create a global function. I verified this in IE6, FF, Chrome, Opera. Consider the following code:
<head>
<title>Never called again</title>
<style type="text/css">
</style>
<script type="text/javascript">
function hello() {
function never_called_again(args) {
alert("Hello world " + never_called_again);
//do some stuff
never_called_again = function (new_args) {
//do some new stuff
alert("hello " + never_called_again);
}
}
never_called_again();
never_called_again();
}
</script>
</head>
<body onload="">
<button onclick="hello(); never_called_again();">Call</button>
</body>
This will print "Hello World {function code}" the first time of the never_called_again and the second time it will print "hello {changed function code}" the second time. But when its being called on button's onclick, it will throw error saying that the function is not defined, clearly indicating that the function was re-defined (and not created globally).
Yes, it's possible, and it will not create a global function. I verified this in Internet Explorer 6, Firefox, Chrome, and Opera. Consider the following code:
<head>
<title>Never called again</title>
<style type="text/css">
</style>
<script type="text/javascript">
function hello() {
function never_called_again(args) {
alert("Hello world " + never_called_again);
//do some stuff
never_called_again = function (new_args) {
//do some new stuff
alert("hello " + never_called_again);
}
}
never_called_again();
never_called_again();
}
</script>
</head>
<body onload="">
<button onclick="hello(); never_called_again();">Call</button>
</body>
This will print "Hello World {function code}" the first time of the never_called_again and the second time it will print "hello {changed function code}" the second time.
But when it's being called on button's onclick, it will throw an error saying that the function is not defined, clearly indicating that the function was re-defined (and not created globally).
Yes its possible and it will not create a global function. I verified this in IE6, FF, Chrome, Opera. Consider the following code:
<head>
<title>Never called again</title>
<style type="text/css">
</style>
<script type="text/javascript">
function hello() {
function never_called_again(args) {
alert("Hello world " + never_called_again);
//do some stuff
never_called_again = function (new_args) {
//do some new stuff
alert("hello " + never_called_again);
}
}
never_called_again();
never_called_again();
}
</script>
</head>
<body onload="">
<button onclick="hello(); never_called_again();">Call</button>
</body>
This will print "Hello World {function code}" the first time of the never_called_again and the second time it will print "hello {changed function code}" the second time. But when its being called on button's onclick, it will throw error saying that the function is not defined, clearly indicating that the function was re-defined (and not created globally).
Yes its possible and it will not create a global function. I verified this in IE6, FF, Chrome, Opera. Consider the following code:
<head>
<title>Never called again</title>
<style type="text/css">
</style>
<script type="text/javascript">
function hello() {
function never_called_again(args) {
alert("Hello world " + never_called_again);
//do some stuff
never_called_again = function (new_args) {
//do some new stuff
alert("hello " + never_called_again);
}
}
never_called_again();
never_called_again();
}
</script>
</head>
<body onload="">
<button onclick="hello(); never_called_again();">Call</button>
</body>
This will print "Hello World {function code}" the first time of the never_called_again and the second time it will print "hello {changed function code}" the second time. But when its being called on button's onclick, it will throw error saying that the function is not defined, clearly indicating that the function was re-defined.
Yes its possible and it will not create a global function. I verified this in IE6, FF, Chrome, Opera. Consider the following code:
<head>
<title>Never called again</title>
<style type="text/css">
</style>
<script type="text/javascript">
function hello() {
function never_called_again(args) {
alert("Hello world " + never_called_again);
//do some stuff
never_called_again = function (new_args) {
//do some new stuff
alert("hello " + never_called_again);
}
}
never_called_again();
never_called_again();
}
</script>
</head>
<body onload="">
<button onclick="hello(); never_called_again();">Call</button>
</body>
This will print "Hello World {function code}" the first time of the never_called_again and the second time it will print "hello {changed function code}" the second time. But when its being called on button's onclick, it will throw error saying that the function is not defined, clearly indicating that the function was re-defined (and not created globally).
Yes its possible and it will not create a global function. I verified this in IE6, FF, Chrome, Opera. Consider the following code:
Never called again function hello() { function never_called_again(args) { alert("Hello world " + never_called_again); //do some stuff never_called_again = function (new_args) { //do some new stuff alert("hello " + never_called_again); } } never_called_again(); never_called_again(); } Call <head>
<title>Never called again</title>
<style type="text/css">
</style>
<script type="text/javascript">
function hello() {
function never_called_again(args) {
alert("Hello world " + never_called_again);
//do some stuff
never_called_again = function (new_args) {
//do some new stuff
alert("hello " + never_called_again);
}
}
never_called_again();
never_called_again();
}
</script>
</head>
<body onload="">
<button onclick="hello(); never_called_again();">Call</button>
</body>
This will print "Hello World "{function code}" the first time of the never_called_again and the second time it will print "hello "{changed function code}" the second time. But when its being called on button's onclick, it will throw error saying that the function is not defined, clearly indicating that the function was re-defined.
Yes its possible and it will not create a global function. I verified this in IE6, FF, Chrome, Opera. Consider the following code:
Never called again function hello() { function never_called_again(args) { alert("Hello world " + never_called_again); //do some stuff never_called_again = function (new_args) { //do some new stuff alert("hello " + never_called_again); } } never_called_again(); never_called_again(); } CallThis will print "Hello World " the first time of the never_called_again and the second time it will print "hello " the second time. But when its being called on button's onclick, it will throw error saying that the function is not defined, clearly indicating that the function was re-defined.
Yes its possible and it will not create a global function. I verified this in IE6, FF, Chrome, Opera. Consider the following code:
<head>
<title>Never called again</title>
<style type="text/css">
</style>
<script type="text/javascript">
function hello() {
function never_called_again(args) {
alert("Hello world " + never_called_again);
//do some stuff
never_called_again = function (new_args) {
//do some new stuff
alert("hello " + never_called_again);
}
}
never_called_again();
never_called_again();
}
</script>
</head>
<body onload="">
<button onclick="hello(); never_called_again();">Call</button>
</body>
This will print "Hello World {function code}" the first time of the never_called_again and the second time it will print "hello {changed function code}" the second time. But when its being called on button's onclick, it will throw error saying that the function is not defined, clearly indicating that the function was re-defined.