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;
window.console.log = function ( output ) { | |
if ( typeof output == "Array" || typeof output === "Object" ) | |
output = JSON.stringify( output, null, 2 ); | |
document.getElementById( "console" ).innerHTML += output + "\n"; | |
}; |
$ 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 |
"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 |
var testArray1 = [1, 0, -1]; // expected [-1, 1] | |
var testArray2 = [1, 1, 1, 1, 1, 1]; // expected [1, 1] | |
var testArray3 = []; //expected [] | |
function getBounds ( intArray ) { | |
var MIN_INT; | |
var MAX_INT; | |
if ( intArray.length <= 0 ) return []; |
const jobsArray = [].slice.call( jobs ); | |
const jobsToInvoice = jobsArray.map( job => ({ | |
name: job.name, | |
quantity: 1, | |
unit_price: { | |
currency: "USD", | |
value: job.cost | |
} | |
})); |
updateProgress = () => { | |
this.setState({ progress: 0 }); | |
const min = 1; | |
const max = 60; | |
const totalTime = Math.floor(Math.random() * (max - min + 1) + min); | |
let counter = 0; | |
var progInterval = setInterval(() => { | |
counter++; |
{"lastUpload":"2019-09-23T23:32:21.123Z","extensionVersion":"v3.4.2"} |
FILE: /Users/jacoblamont/Sites/phpsniffer/plugins/autoupdater/tmpl/configuration.tmpl.php | |
-------------------------------------------------------------------------------------------------------- | |
FOUND 12 ERRORS AND 1 WARNING AFFECTING 11 LINES | |
-------------------------------------------------------------------------------------------------------- | |
4 | ERROR | [ ] All output should be run through an escaping function (see the Security sections in | |
| | the WordPress Developer Handbooks), found '$template_enabled'. | |
6 | ERROR | [ ] All output should be run through an escaping function (see the Security sections in | |
| | the WordPress Developer Handbooks), found '__'. | |
6 | ERROR | [ ] All output should be run through an escaping function (see the Security sections in |
FILE: /Users/jacoblamont/Sites/phpsniffer/plugins/autoupdater/tmpl/configuration.tmpl.php | |
-------------------------------------------------------------------------------------------------------- | |
FOUND 12 ERRORS AND 1 WARNING AFFECTING 11 LINES | |
-------------------------------------------------------------------------------------------------------- | |
4 | ERROR | [ ] All output should be run through an escaping function (see the Security sections in | |
| | the WordPress Developer Handbooks), found '$template_enabled'. | |
6 | ERROR | [ ] All output should be run through an escaping function (see the Security sections in | |
| | the WordPress Developer Handbooks), found '__'. | |
6 | ERROR | [ ] All output should be run through an escaping function (see the Security sections in | |
| | the WordPress Developer Handbooks), found '$plugin_name'. |