Follow

Strings

 (Using strings in JavaScript)


In JavaScript, a string is just a series of characters. Stings can include both text and numbers, and are always contained within single or double quotes.

(Example)

var x = "FastField";

You can add strings together, however if there is at least one string, it will concatenate (combine side by side) as opposed to mathematically adding them.

(Example)

var x = "FastField_";
var y = 'Mobile_Forms';
return x + y;

FastField_Mobile_Forms

As we mentioned before, numbers can be strings too, but they do not function as they normally would when put in quotations.

(Example)

var x = "123";
var y = '456';
return x + y;

123456

You can also find the length of any text using the built in, “.length” property.

(Example)

var x = "FastField";
var y = x.length;

return y;

9

For more information about strings, you can read this article:
http://www.w3schools.com/js/js_strings.asp

Have more questions? Submit a request

Comments

Powered by Zendesk