Skip to main content
Stack Overflow
  1. About
  2. For Teams

Return to Answer

Post Timeline

Active reading. [(its = possessive, it's = "it is" or "it has". See for example <http://www.wikihow.com/Use-Its-and-It%27s>.)]
Source Link
Peter Mortensen
  • 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).

added 27 characters in body
Source Link
naikus
  • 24.5k
  • 4
  • 45
  • 44

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).

Changed the markup, a bit; edited body
Source Link
naikus
  • 24.5k
  • 4
  • 45
  • 44

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(); } Call

This 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.

Source Link
naikus
  • 24.5k
  • 4
  • 45
  • 44
Loading
lang-js

AltStyle によって変換されたページ (->オリジナル) /