Skip to content

Instantly share code, notes, and snippets.

@karfau
Last active November 15, 2019 18:19
Show Gist options
  • Save karfau/8c9d722861c8405e8823d1320bb47322 to your computer and use it in GitHub Desktop.
Save karfau/8c9d722861c8405e8823d1320bb47322 to your computer and use it in GitHub Desktop.
math exercises
// 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