// ~~ used to convert some types to int (32 bit int)
// Examples
// ~~NaN = 0
// ~~'-1' = -1
// ~~true = 1
// ~~false = 0
// ~~5.6 = 5
"??" is called Nullish coalescing operator.
return the right hand side of operator if left hand side is null or undefined.
For example.
const foo = null ?? 'default string';
console.log(foo);
// expected output: "default string" because left hand side is null
const baz = 0 ?? 42;
console.log(baz);
// expected output: 0 . because 0 is not null or undefined.
~~'-1' = -1
~~true = 1
~~false = 0
~~5.6 = 5
;(function( $, $$ ){ 'use strict';
// skipped
})(
typeof jQuery !== 'undefined' ? jQuery : null,
typeof cytoscape !== 'undefined' ? cytoscape : null
);
~~ used to convert some types to int (32 bit int)
// The `...` operator breaks down an array to individual arguments.
// For example lets create an array,
let array = [1, 2, 3];
// And a function that will return a sum of 3 values.
function sum(x, y, z) {
return(x + y + z);
}
// The `sum` function doesn't accept an array as a single argument,
// so a solution for this would be calling it individual indexes in the array:
sum(array[0], array[1], array[2]);
// Or we can just do:
sum(...array)
// does the same thing
The optional chaining operator (?.) enables you to read the value of a
property located deep within a chain of connected objects without having
to check that each reference in the chain is valid.
~N = -(N+1)
let array = [...value]