Earlier quoted context omitted.
It appears to have a limited JS validator to prevent you from using anything other than the limited operators it allows.
It really doesn't like having anything after "return" except a single value or variable.
Do you know your bitwise operators?
11–20 of 32 posts
Re: Do you know your bitwise operators?
#12Validator seems broken.
function one_bit(x) {
return 1
}
Solution did not return correct output for x=1. Expected output: 1, got: 0
umm... okRe: Do you know your bitwise operators?
#13This is stated to be a puzzle. But, when does this actually get used? Are there use cases of bit manipulation in JS? I've never understood when using bit operators could be necessary or even useful. Of course, I'm speaking from my experience building web apps; ruby, python, js, php, etc. I don't have much other programming experience
Re: Do you know your bitwise operators?
#14Re: Do you know your bitwise operators?
#15This is stated to be a puzzle. But, when does this actually get used? Are there use cases of bit manipulation in JS? I've never understood when using bit operators could be necessary or even useful. Of course, I'm speaking from my experience building web apps; ruby, python, js, php, etc. I don't have much other programming experience
- Interacting with hardware that uses certain bits in a register to control behavior - for example, Arduino digital ports [2]
- Doing arithmetic extra-fast with numbers that are powers of two - modulo becomes bitwise-and, division and multiplication become shifts
[1] http://en.wikipedia.org/wiki/List_of_monochrome_and_RGB_pale...
Re: Do you know your bitwise operators?
#16Re: Do you know your bitwise operators?
#17This is stated to be a puzzle. But, when does this actually get used? Are there use cases of bit manipulation in JS? I've never understood when using bit operators could be necessary or even useful. Of course, I'm speaking from my experience building web apps; ruby, python, js, php, etc. I don't have much other programming experience
Re: Do you know your bitwise operators?
#18Validator seems broken.
Oops, i'll fix it.
Re: Do you know your bitwise operators?
#19This is stated to be a puzzle. But, when does this actually get used? Are there use cases of bit manipulation in JS? I've never understood when using bit operators could be necessary or even useful. Of course, I'm speaking from my experience building web apps; ruby, python, js, php, etc. I don't have much other programming experience
Re: Do you know your bitwise operators?
#20This is stated to be a puzzle. But, when does this actually get used? Are there use cases of bit manipulation in JS? I've never understood when using bit operators could be necessary or even useful. Of course, I'm speaking from my experience building web apps; ruby, python, js, php, etc. I don't have much other programming experience
To do this exercise in javascript is pretty silly. But as a systems developer, I can tell you that bit manipulation happens all over the place in my line of work.