Jump to content

Tutorial Strings


mmmartin123456

Recommended Posts

where i can use this ????

 

Or you can put quotes inside a string by using the escape character:

 

var answer = 'It's alright';

var answer = "He is called "Johnny"";

 

if it work too without and is corect displey

<p id="demo"></p><script>var carName1 = "Volvo XC60";var carName2 = 'Volvo XC60';var answer1 = "It's alright";var answer2 = "He is called 'Johnny'";var answer3 = 'He is called "Johnny"';document.getElementById("demo").innerHTML = carName1 + "<br>" + carName2 + "<br>" + answer1 + "<br>" + answer2 + "<br>" + answer3</script>

why is this in special charakters table code ?

 

' single quote " double quote

 

Link to comment
Share on other sites

They're there because there are cases when they are necessary. For example:

var str = "He's called "Johnny"";var str = 'He's called "Johnny"';
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...