<script>
var abc="MC:xxx-xxx:155555.0event18=555.0|event25=eVar25=|eVar26=E|eVar27=95583|eVar28=visa|eVar29=xxx|eVar30=xxx|eVar31=xxxxeVar20=xxx,=",MC:xxx-xxx:155555.0event18=555.0|event25=eVar25=|eVar26=E|eVar27=95583|eVar28=visa|eVar29=xxx|eVar30=xxx|eVar31=xxxxeVar20=xxx,=",MC:xxx-xxx:155555.0event18=555.0|event25=eVar25=|eVar26=E|eVar27=95583|eVar28=visa|eVar29=xxx|eVar30=xxx|eVar31=xxxxeVar20=xxx"
var michen = abc.split(',')
var arr = new Array()
arr[0] = new Array()
arr[1] = new Array()
arr[2] = new Array()
for (x = 0x <michen.lengthx++)
{
michen2 = michen[x].split('')
for (y =0y<michen2.lengthy++)
{
// alert("x="+x)
//alert("y="+y)
arr[x][y] = michen2[y]
}
}
alert(michen.length)
var zhang = arr[0][5]
alert(zhang)
</script>
意思你要通过字符串获得变量的实例,浏览器环境下,通过var定义的变量,可以在window中找到,比如
var a = "hello world"
console.log(window.a)//hello world
在node环境下可能是在global下也能找到,但是没试过,要是ES6的let定义的,我感觉是很难取到,因为可能存在编译器的栈里面