how to make a string in javascript

var abc = "abcdefghijklmnopqrstuvwxyz";
var esc = 'I don\'t \n know';   // \n new line
var len = abc.length;           // string length
abc.indexOf("lmno");            // find substring, -1 if doesn't contain 
abc.lastIndexOf("lmno");        // last occurance
abc.slice(3, 6);                // cuts out "def", negative values count from behind
abc.replace("abc","123");       // find and replace, takes regular expressions
abc.toUpperCase();              // convert to upper case
abc.toLowerCase();              // convert to lower case
abc.concat(" ", str2);          // abc + " " + str2
abc.charAt(2);                  // character at index: "c"
abc[2];                         // unsafe, abc[2] = "C" doesn't work
abc.charCodeAt(2);              // character code at index: "c" -> 99
abc.split(",");                 // splitting a string on commas gives an array
abc.split("");                  // splitting on characters
128.toString(16);               // number to hex(16), octal (8) or binary (2)

4.2
5
Phoenix Logan 186120 points

                                    //In Javascript, a string can be declared using "" or ''.

4.2 (5 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
javascript string js strings JavaScript Strings using string in js make string java script string functions w3c javascript create string using js javascript string functions syntax to create a string in JavaScript string function in js string js string in js js String() $ in javascript string define string js ^ string in javascript example writing string in javascript make string in js new String() javascript js write a string with \ create a string javascript how to work with strings in javascript how to define a string in javascript javascript to make a string make something a string javascript work with strings in javascript java script define string js create string strings in javascript create string in javascript how to write js in a string create javascript from string how to string in javascript how to create a string method in javascript js string create writing strings in javascript how to declare a string in a function js js new string create a new string from string javascript make a string in javascript how to make something a string in javascript how to write a string in javascript new string javascript how to declare a string in javascript how to create a string in JS create a string with \ js how to write string in javascript working with strings in javascript javascript define in string new String js javascript new string create string javascript declare string javascript how to write string in js create new string javascirpt make ' a string js how to * a string in javascript create new string javascript how to declare string in javascript how to make a string in js how to define string in javascript how to sting a function in javascript js different ways to create a string js make string js create a string create js string new string in javascript new string in js javascript make string how to make a string in javascript
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source