-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.js
executable file
·61 lines (51 loc) · 1.43 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*jslint indent: 2, node: true, stupid: true, nomen: true */
/*global */
// var argv = process.argv,
// argc = argv.length,
// main = function (argc, argv) {
// 'use strict';
// var player = [
// { name: 'Virat' },
// { name: 'MESSI' },
// { name: 'CR7' }
// ];
// var quals = [
// { qualification: 'B.E' },
// { Salary: '$100' }
// ];
// var qual = quals.reduce(function (acc, val) {
// Object.getOwnPropertyNames(val).forEach(function (name) {
// acc[name] = val[name];
// });
// return acc;
// });
// console.log(qual);
// var result = player.map(function (val) {
// Object.getOwnPropertyNames(qual).forEach(function (name) {
// val[name] = qual[name];
// });
// return val;
// });
// console.log(result);
// // Expect:
// // [
// // { name: 'Virat', qualification: 'B.E', Salary: '$100' },
// // { name: 'MESSI', qualification: 'B.E', Salary: '$100' },
// // { name: 'CR7', qualification: 'B.E', Salary: '$100' }
// // ]
// };
// main(argc, argv);
function main(val) {
var digits = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'],
s = '',
t=0;
do {
t = ((val - 1) % 26);
s = digits[t] + s;
val = Math.floor((val - t)/26);
} while (val > 0);
console.log(s);
}
for (i = 1; i < 200; i+= 1) {
main(i);
}