colorbox v1.3.15 from colorpowered.com has this javascript in it's minified code:
c.name=i+ +new Date;
this seems to run perfectly, should it?
By default, when you run new Date() in your terminal, it uses your browser's time zone and displays the date as a full text string, like Fri Jul 02 2021 12:44:45 GMT+0100 (British Summer Time).
The conditional (ternary) operator is the only JavaScript operator that takes three operands: a condition followed by a question mark ( ? ), then an expression to execute if the condition is truthy followed by a colon ( : ), and finally the expression to execute if the condition is falsy.
New keyword in JavaScript is used to create an instance of an object that has a constructor function. On calling the constructor function with 'new' operator, the following actions are taken: A new empty object is created.
The open() method opens a new browser window, or a new tab, depending on your browser settings and the parameter values.
The unary +
operator is used to convert an object to a number by calling valueOf()
from that object. If a number is not returned, the operation returns NaN
You can customize this by editing the valueOf
function for any object, like so:
var foo = {};
foo.valueOf = function () { return 9001; };
console.log(+foo); // 9001
Date's valueOf()
simply returns getTime()
(according to Mozilla)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With