Fun Fragment of Javascript

davidktw

Arch-Supremacy Member
Joined
Apr 15, 2010
Messages
13,547
Reaction score
1,300
So what am I doing with this fragment of codes?
JavaScript:
console.log(String.fromCharCode(...[...Array(11).keys()].map(x=>Math.round((3827*(x+1)**10)/907200-(92357*(x+1)**9)/362880+(807637*(x+1)**8)/120960-(6042593*(x+1)**7)/60480+(20304973*(x+1)**6)/21600-(99877913*(x+1)**5)/17280+(8480639179*(x+1)**4)/362880-(2761745939*(x+1)**3)/45360+(4881462049*(x+1)**2)/50400-(42248461*(x+1))/504+29492))));

:)
 

peterchan75

Supremacy Member
Joined
Apr 26, 2003
Messages
6,719
Reaction score
529
Such code a debug nightmare?

Off topic. Why a $ and . number string takes 2 seconds to display? It should be milliseconds right ?
 

davidktw

Arch-Supremacy Member
Joined
Apr 15, 2010
Messages
13,547
Reaction score
1,300
Such code a debug nightmare?
Anything that is new or unknown to an individual can be a nightmare.
Off topic. Why a $ and . number string takes 2 seconds to display? It should be milliseconds right ?
How do you know the display itself took 2s, and not something that happened before it that took 2s? In fact milliseconds would be too slow, it should be in the order of magnitude microseconds. Accessing the storage and network which are freaking slow in comparison is already in milliseconds.

Let me give you an idea, the physical straight line distance between Singapore and USA is roughly 15280KM, means 30560KM back and fro. The speed of light is 299792KM/s. That means ignoring all other latency, If I ping a server in USA, it should take no shorter than 0.101s = 101ms.

Code:
# ping 154.38.174.24
PING 154.38.174.24 (154.38.174.24): 56 data bytes
64 bytes from 154.38.174.24: seq=0 ttl=48 time=274.535 ms
64 bytes from 154.38.174.24: seq=1 ttl=48 time=287.833 ms
64 bytes from 154.38.174.24: seq=2 ttl=48 time=306.390 ms
64 bytes from 154.38.174.24: seq=3 ttl=48 time=326.196 ms

So how could display something on your screen takes in the magnitude of ms unless it is something else that delay it? Your system operates in Ghz clockspeed these days and electromagnetic works at speed of light.

:)
 
Last edited:

peterchan75

Supremacy Member
Joined
Apr 26, 2003
Messages
6,719
Reaction score
529
So what am I doing with this fragment of codes?
JavaScript:
console.log(String.fromCharCode(...[...Array(11).keys()].map(x=>Math.round((3827*(x+1)**10)/907200-(92357*(x+1)**9)/362880+(807637*(x+1)**8)/120960-(6042593*(x+1)**7)/60480+(20304973*(x+1)**6)/21600-(99877913*(x+1)**5)/17280+(8480639179*(x+1)**4)/362880-(2761745939*(x+1)**3)/45360+(4881462049*(x+1)**2)/50400-(42248461*(x+1))/504+29492))));

:)
Back to this topic.
It just print Hello World. You are working on encryption project?
It loop from 0 to 11 and convert numeric to Unicode according to ChatGPT. :oops:
 

peterchan75

Supremacy Member
Joined
Apr 26, 2003
Messages
6,719
Reaction score
529
How do you know the display itself took 2s, and not something that happened before it that took 2s? In fact

According to the media. So out of curiosity, I consult expert.
Using 101ms, 1 second roughly 9.9. An hour, is 35.9K. During rush hour, it's definitely more than 35.9K.
 

davidktw

Arch-Supremacy Member
Joined
Apr 15, 2010
Messages
13,547
Reaction score
1,300
According to the media. So out of curiosity, I consult expert.
Using 101ms, 1 second roughly 9.9. An hour, is 35.9K. During rush hour, it's definitely more than 35.9K.
Don’t understand what this conversion you are doing. That is how fast electromagnetic waves traverse when you consider speed of light as your constant limit. Given that distance and maximum velocity, information will not be able to traverse faster than that.

All that I am showing you is the order of magnitude, even at a physical distance we are talking in milliseconds, hence 2 characters showing up within your cables and PCB boards, it is a few order of magnitude faster than milliseconds, it should be in the microseconds order.

:)
 

davidktw

Arch-Supremacy Member
Joined
Apr 15, 2010
Messages
13,547
Reaction score
1,300
Back to this topic.
It just print Hello World. You are working on encryption project?
It loop from 0 to 11 and convert numeric to Unicode according to ChatGPT. :oops:
No encryption here, just mathematics - curve interpolation at play.

:)
 
Important Forum Advisory Note
This forum is moderated by volunteer moderators who will react only to members' feedback on posts. Moderators are not employees or representatives of HWZ Forums. Forum members and moderators are responsible for their own posts. Please refer to our Community Guidelines and Standards and Terms and Conditions for more information.
Top