Why can this js code be output?

Why can this js code output a? What do two dots mean?

Object.prototype.a = "a";
console.log(1..a) // a
Jul.18,2022

your question is equivalent to: 1..toString () Why can it be executed while 1.toString () cannot?

for numbers, 1. is parsed as a number, so to call the number method, we can use 1..toString () , or we can use (1). ToString () , (1.). ToString ().

therefore, for your example, it is equivalent to console.log ((1) .a), and of course you can output it.


1.===1//true

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b39e09-2c1c0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b39e09-2c1c0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?