Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

229
Views
Why is this "Hello, World!" JavaScript code fragment recognized as an acceptable program instruction?

Recently a coworker showed this fragment of JavaScript code:

greet = "‮".toString.bind("hello world!")

If you paste this inside the Developer Console and execute it will print a "Hello, World!" message:

>> console.log(greet())
hello, world!

Another interesting thing I found is that if you paste the same greet code inside Node.js REPL it will automatically transpile it to a "readable" format.

How does this work? Why is this behaviour possible in a browser and why does Node.js automatically format it?

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

The actual code is:

greet = "...".toString.bind("hello world!")

Where the ... in the string literal are the bytes E2 80 AE, which is the right-to-left override Unicode character, which causes everything after it to be displayed in reverse. It's used for writing right-to-left languages like Arabic or Hebrew.

hex editors are your friend

over 4 years ago · Santiago Trujillo Report

0

You have hidden characters which reverse the text. Here you can see the raw characters: https://www.soscisurvey.de/tools/view-chars.php

enter image description here

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!