Hi Student,
Your problem is one of scope. The question you have to answer is what is the value of btnNum
when the onclick
function is called.
Consider the following example:
var foo;
"use strict"; | |
/* | |
* Challenge: | |
* You are given a function 'secret()' that accepts a single integer parameter | |
* and returns an integer. In your favorite programming language, write a | |
* command-line program that takes one command-line argument (a number) and | |
* determines if the secret() function is additive | |
* [secret(x+y) = secret(x) + secret(y)], for all combinations x and y, where x | |
* and y are all prime numbers less than the number passed via the command-line |
$ npm install | |
npm WARN deprecated graceful-fs@3.0.8: graceful-fs version 3 and before will fail on newer node releases. Please update to graceful-fs@^4.0.0 as soon as possible. | |
npm WARN deprecated graceful-fs@2.0.3: graceful-fs version 3 and before will fail on newer node releases. Please update to graceful-fs@^4.0.0 as soon as possible. | |
npm WARN prefer global jshint@2.9.1 should be installed with -g | |
> git-validate@2.1.4 install /Users/jacob_lamont/Quietyme/Website/frontend/node_modules/react-grid-layout/node_modules/git-validate | |
> node bin/install | |
> fsevents@1.0.11 install /Users/jacob_lamont/Quietyme/Website/frontend/node_modules/react-grid-layout/node_modules/fsevents |
window.console.log = function ( output ) { | |
if ( typeof output == "Array" || typeof output === "Object" ) | |
output = JSON.stringify( output, null, 2 ); | |
document.getElementById( "console" ).innerHTML += output + "\n"; | |
}; |