Echo JS 0.11.0

photopea 314 days ago.
There is a tool, which simplifies JS code:

You have to write a program, that prints the current timestamp:, and is located in an anonymous function, i.e. between "(function(){"  and  "})()".

But it should not contain "" in a simplified version.

My first attempt:

... but the right side does contains Can you "outsmart" that tool?

sylvainpv 313 days ago. link 2 points
The goal is to evaluate the function with a runtime condition, so that prepack is forced to keep the dynamic evaluation. This can be done with Math.random() or +(new Date()) or many environment properties, but none of them are supported by Prepack. Any runtime-dependent expression throws an IntrospectionError:

console.log(Date[Math.random() > 0 ? "now" : "nope"]())
sashee 313 days ago. link 1 point
Well, it crashes the tool but passes all the requirements:

  var fn = Math.random() <= 1 ? "Date": "";

    at repl:3:22
    at repl:1:1
calois 314 days ago. link 1 point
Not sure about the code below:

  var v = Math.ceil(Math.random()*1000);
  for(var i=0;i<5;i++){
	  v = Math.ceil(v/10);
  var t = ['ac','te'];
photopea 313 days ago. link 1 point
The task was a program, that always prints a timestamp, but your program prints it "almost always" (when random has not returned a zero). I am not sure if it is a solution, but I like it very much! :)

I wonder if there could be a better solution without randomness.
Swizz 313 days ago. link 0 point
Another contrib, less exotic than the first one, I did :

      (13)["toString"](36).toUpperCase() + 
      (10)["toString"](36) +
      (29)["toString"](36) +
      (23)["toString"](36) +
      (24)["toString"](36) +
photopea 313 days ago. link 1 point
This one does contain "" on the right simplified side.