The Star Bulletin - Daily News Updates

string

How to Check if a String Contains Spaces Using JavaScript

How to Check if a String Contains Spaces Using JavaScript

How to Check if a String Contains Spaces Using JavaScript - The problem with checking for spaces in a string is that it is not as simple as it may seem. There are many ways to check for spaces, and there are also many ways to represent them. The following code checks to see if there are any spaces in a string, but it will not work on all strings:  var text = "Hello World!"; if (text.indexOf(" ") > -1) { console.log("There are spaces in the string"); } else { console.log("There are no spaces in the string"); } How to…
Read More
No widgets found. Go to Widget page and add the widget in Offcanvas Sidebar Widget Area.