How to write negative binary number? [duplicate]

103
August 18, 2019, at 01:50 AM

This question already has an answer here:

  • ECMAScript 6 negative binary literal 1 answer

So 0b1 is 1. How to write -1 in binary format?

The docs says that the leftmost bit is reserved for sign, but where is that leftmost bit? Even 0b11111111111111111111111111111111 is still a positive number. I naively tried 1b with no success of course.

Answer 1

try

let a = -0b1; 
 
console.log(a);

Rent Charter Buses Company
READ ALSO
node.js server running on EC2 can't connect to ElasticCache Redis

node.js server running on EC2 can't connect to ElasticCache Redis

I have a web server running with express and express-session for verification on an AWS EC2 instanceI want to enable a session store for express-session so I am using AWS ElasticCache Redis

144
I need to scrap a part of the html page but I am not sure to determine how it is embedded [on hold]

I need to scrap a part of the html page but I am not sure to determine how it is embedded [on hold]

I am trying to scrap the play by play part of the page, and want to store every detail, shots, faults, points etc in a database, but when I go to the html code it seems it is embedded because I cannot see the detail, how can I scrap the play by play part or determine...

22
Some images not working in `background-image:url()`

Some images not working in `background-image:url()`

Some images not working in background-image:url(), i cant figure out that does i need to remove ( and ) from image name or anything else is an issue?

116