how to check how many strings are in a sentence javascript
function WordCounter (str) {
var words = str.split(" ").length;
return words;
}
// this should work!
how to check how many strings are in a sentence javascript
function WordCounter (str) {
var words = str.split(" ").length;
return words;
}
// this should work!
String Length
//Methods used to obtain information about an object are known as accessor methods. One accessor method that you can use with strings is the length() method, which returns the number of characters contained in the string object.
Example
public class StringDemo {
public static void main(String args[]) {
String palindrome = "Dot saw I was Tod";
int len = palindrome.length(); // Using the length method
System.out.println( "String Length is : " + len );
}
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us