0
   

Requesting help with Javascript

 
 
Reply Sat 29 Aug, 2015 12:52 am
I am learning Javascript. What is wrong with the following code?

var str = prompt("Enter some text");
var numChars = str.length;
for (var i = 0; i < numChars; i++)
{
if (str.slice(i, i + 2) == " ")
{
alert("No double spaces!");
break;
}
else {
alert("There is double space");
break;
}
  • Topic Stats
  • Top Replies
  • Link to this Topic
Type: Question • Score: 0 • Views: 760 • Replies: 1
No top replies

 
darkakari
 
  1  
Reply Sat 29 Aug, 2015 02:51 pm
@dharapat,
Ask google?
0 Replies
 
 

Related Topics

 
  1. Forums
  2. » Requesting help with Javascript
Copyright © 2025 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.03 seconds on 02/05/2025 at 02:45:41