javascript - How to operate array [2,4,8] so that it becomes (2 | 4 | 8)
学习ing2017-06-30 09:59:38
0
3
925
How to operate array [2,4,8] to make it become (2 | 4 | 8)? ?
[2,4,8].join("|") == "2 | 4 | 8", which cannot reach the expected form (2 | 4 | 8). Tried using join repeatedly ....Can't you add the outer brackets? Please help...
Now we need to convert an array [1,2,4] into a numeric type (1|2|4), because we need to convert the converted (1|2|4) into hexadecimal later... So now I don’t know how to convert the array [1,2,4] into (1|2|4).toString(16) operates like this
join 2 times
@vue_小白
The method is as follows:
1. Wow, if you customize a prototype yourself, the default one cannot be achieved.
2. Isn’t it enough to add a () twice to the string?