xxxxxxxxxx
const test = 'hello world'
console.log(test);
//>> hello world | no cool :)
const test = 'hello world'
console.log({test});
//>> {test: 'hello world'} cool =)
xxxxxxxxxx
console.log(Object.getOwnPropertyNames(Math));
//-> ["E", "LN10", "LN2", "LOG2E", "LOG10E", "PI", ...etc ]
xxxxxxxxxx
//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
xxxxxxxxxx
console.log(Object.getOwnPropertyNames(Math).filter(function (p) {
return typeof Math[p] === 'function';
}));
//-> ["random", "abs", "acos", "asin", "atan", "ceil", "cos", "exp", ...etc ]
xxxxxxxxxx
// Console methods
console.log(text)
console.dir(object)
console.error(text)
console.warn(text)
console.table([object])
xxxxxxxxxx
console.log(10); // Integer
console.log(true); // Boolean
console.log('String'); // String
xxxxxxxxxx
//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();
xxxxxxxxxx
// 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}!`)