binary gap
function binaryGap(N) {
const bin = (N >>> 0).toString(2);
const gap = bin.substring(0, bin.lastIndexOf('1'));
const arr = substr.split('1');
return arr.sort().reverse()[0].length;
}
binaryGap(1041);
Also in JavaScript:
- $(this) option selected jquery
- how to print console in javascript
- javascript newline in alert box
- express signed cookies
- Material-ui add comment icon
- express validator always return error
- remove appended element jquery
- datatable loading
- how ot get browser is safari in chrome
- let scores = [80, 90, 70]; for (const score of scores) { console.log(score); }
- trigger window resize
- fillstyle
- json minecraft
- get site url javascript
- how to use the map method in javascript
- get header height jquery
- scrollto angular
- clear formarray in angular 6
- webslesson search bar ajax
- js array modify element
- javascript check string lenght
- react router hooks
- random number js
- how to wait for an exec command to fininsh in nodejs