mmmartin123456 Posted May 15, 2014 Share Posted May 15, 2014 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 More sharing options...
Ingolme Posted May 15, 2014 Share Posted May 15, 2014 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 More sharing options...
justsomeguy Posted May 15, 2014 Share Posted May 15, 2014 var str = '<div onclick="some_function('some_value');">'; Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now