Boredom got the best of me last month, and I've been working on a library for JavaScript ever since. I've read about 20-something tutorials, and plenty of documentation.
And now that I have a tiny, simple (but working) library, I want to change the syntax that is used when writing the code.
And I think I may have just found a way to do it. Or, more possibly, I may have just embarrassed myself with the following line, and question:
string = new String('string');
That line up there; does it create a new type
of type string
, and call it string
? Or does that line do something else, or is it basically the same as:
string string = "hey";
The reason I am asking is, I am interested in learning how to change things. I would like to be able to declare a new string like this, in my tiny js library:
txt someString = "hey";
... where txt
is the data type 'string'.
And then use it like this:
if(someString == "hey") { return true; }