console.log(10);
console.log('You can also log numbers')
var a=10;
var b=20;
console.log(a);
// Expected output: 10
console.log(b);
// Expected output: 20
console.log(a,b);
// Expected output: 10 20
console.log('zama')
// In addition to TopHacker's answer
console.assert(/** Condition **/, /** Error message **/);
console.trace();
debugger; // will force execution halt at the line where this is written allowing code inspection
//how to see js output in browser console
//string
console.log("hello"); // hello
//number
console.log(125); //125
//variable
let val = "Hi! I am a shahjalal";
console.log(val) // Hi! I am shahjalal
console.log(69)
console.log("dale")
console.log('Hi there!');
// Prints: Hi there!
console.log('I want to log this so I am logging this. Calm down and log.')
//return something in the console
console.log(string);
//return something in the console marked as an error
console.error(string);
//return something in the console marked as a warning
console.warn(string);
//return something in the console in a table
console.table([{json strings}];
//clear the console
console.clear();
console.log("");
console.log(10); // Integer
console.log(true); // Boolean
console.log('String'); // String
// console.log("") is usefull for a lot of things
const myNumberOne = 69;
const myNumberTwo = 420;
console.log(myNumberOne + myNumberTwo);
// Example 2
let x = 4;
let y = 2;
console.log(`The difference between x and y is ${x - y}!`)
console.log("Hello, world.");
// Hello, world.
let num = 5;
console.log(num);
// 5
console.log(message);
let sum = 44;
console.log(sum); // 44
var players = ['Jim', 'Shawna', 'Andrew', 'Lora', 'Aimee', 'Nick'];
console.log(players);
console.log('Testing console');
VS CODE JavaScript (ES6) code snippets:
clg ==> console.log(object);
clo ==> console.log('object :', object);
ccl ==> console.clear(object);
cer ==> console.error(object);
ctr ==> console.trace(object);
clt ==> console.table(object);
cin ==> console.info(object);
cco ==> console.count(label);
CONSOLE LOG LIKE A PRO:
Put {} to have label value pairs
// e.g console.log({data, name}); returns data: data, name: name
Console.table() puts data in table!
Console.group() ... console.groupEnd() //groups console logs inside these together
Console.assert only logs if first param falsey!
Console.count keeps track!
console.time and console.timeLog / timeend outputs how long took.
%c first char in string to add custom css:)