/**
I think that you might be looking for
the js "arrow function"; I hope that
this example below helps ;)
**/
// usual function
function fartOne(){
console.log('Pooofff... pof.. ppf.. poof.. p');
}
// arrow function to do the same
const fartTwo = () => console.log('Baaaf... paf.. poof.. poffie.. plop');
// call the functions to test 'em out..
fartOne();
fartTwo();
// Javascript => is called Arrow Function: A short syntax for functions
hello1 = function(name) {
return "Hello " + name + "!";
} // can be replaced with arrow function. See below.
hello2 = (name) => { return "Hello " + name + "!"; } // Arrow Function =>
hello3 = (name) => "Hello " + name + "!"; // Even shorter =>
console.log(hello1("Alice"), hello2("Bob"), hello3("Ada"))
// binary
const a = 5; // 00000000000000000000000000000101
const b = 2; // 00000000000000000000000000000010
const c = -5; // 11111111111111111111111111111011
console.log(a >> b); // 00000000000000000000000000000001
// expected output: 1
console.log(c >> b); // 11111111111111111111111111111110
// expected output: -2