Last active
November 15, 2019 18:19
-
-
Save karfau/8c9d722861c8405e8823d1320bb47322 to your computer and use it in GitHub Desktop.
math exercises
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// requires lodash being present as _, e.g. in the dev console on https://lodash.com/docs | |
// random | |
var result = []; for (i=0;i<50;i++) {let a = `${_.sample.call(null, _.range(2, 21))} * ${_.sample.call(null, _.range(2, 16))}`; result.push(`${a} = ${eval(a)}`);} console.log(result.join('\n')) | |
// all ordered | |
var result = []; for (i=1;i<21;i++) { for (j=1;j<11;j++) { let a = `${i} * ${j}`; result.push(`${a} = ${eval(a)}`);}} console.log(result.join('\n')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment