Skip to main content
added 26 characters in body
Source Link
Timwi
  • 13k
  • 3
  • 46
  • 66

JavaScript:

g = function () { H = 3 return H + H } f = function () { Η = 2 return Η + H } // 3 + 3 = 6 alert(g()) // 2 + 2 = 5 alert(f()) 

Check it at http://jsfiddle.net/qhRJY/

Both the H character(Latin letter capital h) and the Unicode Η character(Greek letter capital eta) are set to the global scope because they were not defined as local to the functions with the var keyword. While they look similar, they are actually 2 different variables with 2 different values. Using Ctrl+F in your browser you will find that Η (eta) shows up significantly less than H (h) on this page.

JavaScript:

g = function () { H = 3 return H + H } f = function () { Η = 2 return Η + H } // 3 + 3 = 6 alert(g()) // 2 + 2 = 5 alert(f()) 

Check it at http://jsfiddle.net/qhRJY/

Both the H character and the Unicode Η character are set to the global scope because they were not defined as local to the functions with the var keyword. While they look similar, they are actually 2 different variables with 2 different values. Using Ctrl+F in your browser you will find that Η shows up significantly less than H on this page.

JavaScript:

g = function () { H = 3 return H + H } f = function () { Η = 2 return Η + H } // 3 + 3 = 6 alert(g()) // 2 + 2 = 5 alert(f()) 

Check it at http://jsfiddle.net/qhRJY/

Both H (Latin letter capital h) and Η (Greek letter capital eta) are set to the global scope because they were not defined as local to the functions with the var keyword. While they look similar, they are actually 2 different variables with 2 different values. Using Ctrl+F in your browser you will find that Η (eta) shows up significantly less than H (h) on this page.

Removed syntax highlighting to make the answer less obvious
Source Link

JavaScript:

g = function () { H = 3 return H + H } f = function () { Η = 2 return Η + H } // 3 + 3 = 6 alert(g()) // 2 + 2 = 5 alert(f()) 
g = function () { H = 3 return H + H } f = function () { Η = 2 return Η + H } // 3 + 3 = 6 alert(g()) // 2 + 2 = 5 alert(f()) 

Check it at http://jsfiddle.net/qhRJY/

Both the H character and the Unicode Η character are set to the global scope because they were not defined as local to the functions with the var keyword. While they look similar, they are actually 2 different variables with 2 different values. Using Ctrl+F in your browser you will find that Η shows up significantly less than H on this page.

JavaScript:

g = function () { H = 3 return H + H } f = function () { Η = 2 return Η + H } // 3 + 3 = 6 alert(g()) // 2 + 2 = 5 alert(f()) 

Check it at http://jsfiddle.net/qhRJY/

Both the H character and the Unicode Η character are set to the global scope because they were not defined as local to the functions with the var keyword. While they look similar, they are actually 2 different variables with 2 different values. Using Ctrl+F in your browser you will find that Η shows up significantly less than H on this page.

JavaScript:

g = function () { H = 3 return H + H } f = function () { Η = 2 return Η + H } // 3 + 3 = 6 alert(g()) // 2 + 2 = 5 alert(f()) 

Check it at http://jsfiddle.net/qhRJY/

Both the H character and the Unicode Η character are set to the global scope because they were not defined as local to the functions with the var keyword. While they look similar, they are actually 2 different variables with 2 different values. Using Ctrl+F in your browser you will find that Η shows up significantly less than H on this page.

Added syntax highlighting and improved formatting
Source Link
Toothbrush
  • 3.3k
  • 1
  • 19
  • 28

Javascript

JavaScript:

g = function () { H = 3 return H + H } f = function () { Η = 2 return Η + H } // 3 + 3 = 6 alert(g()) // 2 + 2 = 5 alert(f()) 

Check it at http://jsfiddle.net/qhRJY/

Both the H character and the Unicode Η character are set to the global scope because they were not defined as local to the functions with the var keyword. While they look similar, they are actually 2 different variables with 2 different values. Using Ctrl+F in your browser you will find that Η shows up significantly less than H on this page.

Javascript

g = function () { H = 3 return H + H } f = function () { Η = 2 return Η + H } // 3 + 3 = 6 alert(g()) // 2 + 2 = 5 alert(f()) 

Check it at http://jsfiddle.net/qhRJY/

Both the H character and the Unicode Η character are set to the global scope because they were not defined as local to the functions with the var keyword. While they look similar, they are actually 2 different variables with 2 different values. Using Ctrl+F in your browser you will find that Η shows up significantly less than H on this page.

JavaScript:

g = function () { H = 3 return H + H } f = function () { Η = 2 return Η + H } // 3 + 3 = 6 alert(g()) // 2 + 2 = 5 alert(f()) 

Check it at http://jsfiddle.net/qhRJY/

Both the H character and the Unicode Η character are set to the global scope because they were not defined as local to the functions with the var keyword. While they look similar, they are actually 2 different variables with 2 different values. Using Ctrl+F in your browser you will find that Η shows up significantly less than H on this page.

Source Link
Loading