js get a console log in variable code example Example 1: how to use js console log console.log('string'); Example 2: print javascript variable in console console.log(p);