Skip to content

ProtoString toObject() Method

Seth Clydesdale edited this page Jun 7, 2015 · 1 revision

<< Back to Conversion Methods

Examples

Converting a string literal into an object.

'Salut'.toObject(); // returns {0:'S', 1:'a', 2:'l', 3:'u', 4:'t', length:5, toString:func()}

You can convert it back to a string by calling the toString method.

var strObj = 'Salut'.toObject();
strObj.toString(); // returns 'Salut'

Description

The toObject method converts a string literal into an object. You can convert an object converted string back to a string literal by calling the toString method on it.

Syntax

String.toObject();
Clone this wiki locally