How do you create a string variable with "text" value? Select all correct options.
Creating a variable in JavaScript is called "declaring" a variable. You declare a JavaScript variable with the var keyword.
var myVariable = "some text";
Read more: JavaScript Strings

@misterds thanks for a link! updated explanation

2018 Jan 30, 5:51:08 PM

HI here is a goo explanation

2017 Dec 15, 5:18:56 PM

@Vadim_Klimets Should be right. Check again please. this code: <pre><code>var s = new String('text'); s</code></pre>

2017 May 18, 12:34:11 AM

Fix it. var s = new String('text'); undefined

2017 Apr 30, 8:23:58 PM

Thanks for a question. Actually, all next statements: var s = new String(text); var s = text; var s = {text}; will fail with following error: [Uncaught ReferenceError: text is not defined] and var s = "t"."ext"; will fail with [Uncaught SyntaxError: Unexpected string]

2015 Oct 8, 9:17:18 PM

There is a glitch with this question. The first option should work, and doesn't according to the results.

2015 Oct 7, 3:42:28 AM

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Sign Up Now
or Subscribe for future quizzes