run js command in console code example
Example 1: javascript run command
const { execSync } = require('child_process');
const output = execSync('ls', { encoding: 'utf-8' });
console.log('The output is:');
console.log(output);
Example 2: how to use the javascript console
/*
shortcuts:
command K = clears the console
command shift M = toggle device toolbar
command shift C = select something on the page
you can also log in a variable you may have coded:
x;
[value of x at that moment]
if you're animating something:
noLoop();
[stops the animation]
loop();
[continues the animation]
you can also code somewhat intricate text:
for (var i = 0; i > 10; i++) {
console.log([variable or anything]);
}
some functions are also available to use:
function mousePressed() {
console.log([anything]);
}
function keyPressed() {
noLoop(); [or anything else]
}
*/