Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript Create Strings

//strings example
const name = 'Peter';
const name1 = "Jack";
const result = `The names are ${name} and ${name1}`;
Comment

Javascript Strings

// JavaScript String
const data =
{
    "name": "John Doe",
    "age": 45
}
function Sample() { return "TEXT"; }

var str1 = 'With " in it "';
var str2 = "With ' in it '";
var str3 = `Contains other Strings >${str1}<, Properties of objects >${data.age}< or return values from functions >${Sample()}<.`;

console.log(str1); // With " in it "
console.log(str2); // With ' in it '
console.log(str3); // Contains other Strings >With " in it "<, Properties of objects >45< or return values from functions >TEXT<.
Comment

Javascript Create Strings

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Strings</h2>

<p>You can use quotes inside a string, as long as they don't match the quotes surrounding the string:</p>

<p id="demo"></p>

<script>
var answer1 = "It's alright";
var answer2 = "He is called 'Johnny'";
var answer3 = 'He is called "Johnny"';

document.getElementById("demo").innerHTML =
answer1 + "<br>" + 
answer2 + "<br>" + 
answer3;
</script>

</body>
</html>
Comment

how to make a string in javascript

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

PREVIOUS NEXT
Code Example
Javascript :: filter in javascript 
Javascript :: javascript email validation 
Javascript :: p5.js typescript 
Javascript :: angular property value does not exist on type Event 
Javascript :: mometjs 
Javascript :: node cron npm how to use 
Javascript :: Put Variable Inside JavaScript String 
Javascript :: how to create a class javascript 
Javascript :: while loop in javascript 
Javascript :: find items in array not in another array javascript 
Javascript :: JavaScript block-scoped Variable9 
Javascript :: npm simple zip file creator 
Javascript :: selected value 
Javascript :: if or react 
Javascript :: materialize dropdown js 
Javascript :: js dictionary 
Javascript :: javascript some method 
Javascript :: array -1 javascript 
Javascript :: array remove last item 
Javascript :: unwind mongodb 
Javascript :: jQuery intellisence in VSCode 
Javascript :: js reduce example 
Javascript :: fibonacci numbers 
Javascript :: es6 concat array 
Javascript :: sticky sessions 
Javascript :: vs code file nesting 
Javascript :: value of javascript 
Javascript :: find how many similar object item in an array in javascript 
Javascript :: onclose modal bootstrap 
Javascript :: appearing datepicker behind the modal 
ADD CONTENT
Topic
Content
Source link
Name
5+9 =