javascript number in alphabet
// converts numbers to spreadsheet letter columns eg. 1 -> A
function numToSSColumn(num){
let s = '', t;
while (num > 0) {
t = (num - 1) % 26;
s = String.fromCharCode(65 + t) + s;
num = (num - t)/26 | 0;
}
return s || undefined;
}
numToSSColumn(0); // undefined
numToSSColumn(1); // A
numToSSColumn(26); // Z
numToSSColumn(-1); // undefined
numToSSColumn(27); // AA
numToSSColumn(475254); // ZZZZ
Also in JavaScript:
- javascript event listener checkbox
- putting a loop into an array javascript
- node js connect to mongodb using mongoose
- find element in array javascript
- javascript reverse each string element in array
- javascript add value to input
- github redux devtools
- react sagas state
- how to update json key name while keeping the values in mysql
- get parameter from the actual url javascript
- nodejs random number
- how to give a person a role by id in discord.js
- javascript capitalize first letter
- javascript got to url
- : Timeout - Async callback was not invoked within the 5000 ms timeout specified by jest.setTimeout.Timeout - Async callback was not invoked within the 5000 ms timeout specified by jest.setTimeout.Error:
- enzynme not support react 17
- pass element from child to parent react
- passing event handler to useEffeect
- my datatable in flutter from json repeat the column headers
- html button click only once
- js indexof
- document queryselectorall and map javacript
- javascript check if date object
- javascript get url parameters