Skip to content

Commit 6dfd5d4

Browse files
committed
added hexatodecimal
1 parent 9c5a9fd commit 6dfd5d4

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
(function(){
2+
3+
var ConvertBase = function (num) {
4+
return {
5+
from : function (baseFrom) {
6+
return {
7+
to : function (baseTo) {
8+
return parseInt(num, baseFrom).toString(baseTo);
9+
}
10+
};
11+
}
12+
};
13+
};
14+
ConvertBase.hex2dec = function (num) {
15+
return ConvertBase(num).from(16).to(10);
16+
};
17+
18+
this.ConvertBase = ConvertBase;
19+
20+
})(this);
21+
console.log(ConvertBase.hex2dec('f8'));
22+

0 commit comments

Comments
 (0)