WrappedUsername
/// @notice augmented addition const myVariable += 2; /// @notice augmented subtraction const myVariable -= 2; /// @notice augmented multiplication const myVariable *= 2; /// @notice augmented division const myVariable /= 2;
const myVariable = 'backslash before, let\'s use "quotation marks" inside a string.';
/** @notice When using both single and double quotation marks inside a string one must use the proper escape sequence, because if you have that same quotation mark somewhere in the middle, the string will stop early and throw an error. */ const myVariable = 'backslash before, let\'s use "quotation marks" inside a string.'; /// @notice The use of single quotation marks allows the proper use of double quotation marks inside the string. const myVariable = '<a href="http://www.example.com" target="_blank">Link</a>';
Command | Description |
---|---|
\' | Single Quotation Mark |
\" | Double Quotation Mark |
\\ | Backslash |
\n | New Line |
\r | Carriage Return |
\t | Tab |
\b | Word Boundry |
\f | Form Feed |
const myString = "FirstLine\n\t\\SecondLine\nThirdLine"; console.log(myString); /** @notice output: FirstLine \SecondLine ThirdLine */
/** @notice Use the += operator to concatenate a string onto the end of an existing string variable. This can be very helpful to break a long string over several lines. */ /// @notice Concatenation does not add spaces between concatenated strings, so you'll need to add them yourself. let myVariable = "This is the first sentence. "; myVariable += "This is the second sentence.";
/** @notice By using the concatenation operator + you can insert one or more variables into a string you're building. */ const myName = "WrappedUsername"; let myVariable = "Hellos my name is " + myName + ", how are you?";
/// @notice Appending variables to a string using the plus equals += operator. const someAdjective = "interesting!"; let myVariable = "Learning to code is "; myVariable += someAdjective;
/// @notice Find the length of a String value by writing .length after the string variable or string literal. let myNameLength = 0; const myName = "WrappedUsername"; console.log(myName.length); myNameLength = myName.length;
I am a self taught Solidity Smart Contract Auditor. Creator of this blog site.
Our sponsor Foam Chunk Smudge NFT, an abstract art project, has created a token pass utility for this NFT. The Foam Chunk Smudge NFT token HODLer community on Discord has access to private channels with special vip only announcements, and much more! Check them out!
© 2023 Journey Blog. All rights reserved.