Way outta my depth on this, but the world seems to have a lot of helpful JS out there.
So I’m wondering how I might incorporate something like this into my RP file:
function rand omStr(m) {
var m = m || 9; s = '', r = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
for (var i=0; i < m; i++) { s += r.charAt(Math.floor(Math.random()*r.length)); }
return s;
};
or this (I’m a copy-paste-ninja):
const recipes = ['arroz', 'burrito', 'enchilada', 'sopa'];
for (let i = 0; i < recipes.length; i++) {
const recipe = recipes[i];
console.log(`Recipe for: ${recipe}`);
}
console.log(`\n=== Using: forEach`);
// this is pretty common so there's a `forEach` method on arrays
function printTheRecipe(recipe) {
console.log(`Recipe for: ${recipe}`);
}
recipes.forEach(printTheRecipe);
Thanks
J