Click here to Skip to main content
15,905,874 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i am trying to split a string in javascript . it works fine in firefox but, it fails in chrome. could anyone please share the ideas in this.

i used the following code:
C#
var v="asd.sdf";
var arr=v.split('.');
Posted
Updated 6-Feb-18 19:51pm
v2
Comments
Sergey Alexandrovich Kryukov 11-Mar-12 2:04am    
Are you sure? Could it be not in this code but just in presentation. What did you use to test it?
--SA
Bikash Shrestha From Nepal 11-Mar-12 4:44am    
if i run the code in chrome console, it works. but if used in php page, it fails

1 solution

I just tried it in Chrome 17.0.963.78 and it works fine:
JavaScript
<script type="text/javascript">

var str="asd.sdf";
var arr = str.split(".");
document.write(arr);
document.write("<br />DONE<br />");
document.write(str.split(".") + "<br />");


</script>

Gave:
asd,sdf
DONE
asd,sdf


What am I doing that is different to you?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900