formatNum.js
968 Bytes
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
// export function formatNum(str) {
// var newStr = "";
// var count = 0;
// for (var i = str.length - 1; i >= 0; i--) {
// if (count % 3 == 0 && count != 0) {
//
// newStr = str.charAt(i) + "," + newStr;
// } else {
// newStr = str.charAt(i) + newStr;
// }
// count++;
// }
// str = newStr;
// return str;
//
// }
function formatNumArr(str) {
// console.log(typeof str)
// console.log(str)
var str = (str).toString();
var newStr = "";
var count = 0;
for (var i = str.length - 1; i >= 0; i--) {
if (count % 3 == 0 && count != 0) {
newStr = str.charAt(i) + "," + newStr;
} else {
newStr = str.charAt(i) + newStr;
}
count++;
}
str = newStr;
str = str.split('')
return str;
}
function formatChanging(val) {
console.log(val)
let tmpHtml = '';
for(let i=0;i<val.length;i++){
tmpHtml += "<li>"+val[i].standard+"</li>"
}
return tmpHtml
}
export default {formatNumArr}