如何计算数组a里面 如:a = [‘2’, ‘*’, ‘5’]
<!DOCTYPE html
>
<html lang
="en">
<head
>
<meta charset
="UTF-8">
<meta name
="viewport" content
="width=device-width, initial-scale=1.0">
<title
>Document
</title
>
</head
>
<body
>
</body
>
<script
>
var a
= ['2', '*', '5']
var xxx
= eval((a
+ "").replace(/,/g, ""))
console
.log(a
)
console
.log((a
+ ""))
console
.log((a
+ "").replace(/,/g, ""))
console
.log(xxx
)
</script
>
</html
>
转载请注明原文地址: https://lol.8miu.com/read-22333.html