M9 1a8 8 0 1 0 0 16A8 8 0 0 0 9 1zm. Join Stack Overflow to learn, share knowledge, and build your career. M9 1a8 8 0 1 0 0 16A8 8 conjoin bitcoin calculator 0 0 9 1zM8 15.
The first alert always returns ‘old number was: ‘ and not 10. Shouldn’t it return 10 on both alerts on the second function call? Thanks for all the answers so fast. 10′, you are declaring number as a local variable each time. 10’ in side function then it will have local scope, we wont get the value 10 outside the function. Remove the var in front of number in your function. The problem is that you’re declaring a new variable named number inside of the function.
10 assigns only to this new local variable. It’s reassuring to see the same answer posted within the same minute. Actually, any definition without ‘var’ will be a global variable, regardless of where it’s defined. You learn something new every day. You can also access it in any function like window.