如何在javascript中提取整数值 [英] How to extract integer value in javascript
本文介绍了如何在javascript中提取整数值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在javascript中有一个值
var = < span class =code-digit> 11 : 20 ;
如何在两个不同的变量中获取价值,我想要的价值如
a = 11 跨度>;
b = 20 ;
我怎样才能得到这些值
解决方案
您可以使用Javascript split方法来破坏字符串。请查看此链接! [ ^ ]
按索引分割和访问结果,例如
var str = 3333, 222\" 跨度>;
var res = str.split( ,跨度>);
var a = res [ 0 ];
var b = res [ 1 ];
I have one value in javascript
var = 11:20;
how to take value in two diffrent varaibles, i want value like
a= 11;
b=20;
how can i get these value
解决方案
You can use Javascript split method to break a string. Check this link![^]
split and access result by index, for example
var str = "3333,222"; var res = str.split(","); var a =res[0]; var b =res[1];
这篇关于如何在javascript中提取整数值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文