Here we will discuss about Concatenating Strings in javascript. Also you can check out:
- C#.Net interview questions and answers
- Working with enterprise library for data access in asp.net Part-3
- Get nth highest lowest salary in SQL Server 2008
Concatenation refers to the act of combining two text strings into one longer text string.
1. Open a new HTML document in your preferred HTML or text editor.
2. Create the body of the document with opening and closing body tags:
<body>
</body>
3. Insert a script block in the body of the document:
<script language="JavaScript">
<!--
// -->
</script>
4. Create a variable named myVariable and assign the value "Hello" to it:
var myVariable = "Hello";
5. Create a second variable named anotherVariable and assign the value "there" to it:
var anotherVariable = "AspDotNetHelp";
6. Concatenate the values of myVariable and anotherVariable, along with a space between them, and assign the results to a third
variable named finalResults:
var finalResults = myVariable + " " + anotherVariable;
7. Display the results so that the final page looks like below
<body>
<script language="JavaScript" type="text/javascript">
<!--
var myVariable = "Hello";
var anotherVariable = "AspDotNetHelp";
var finalResults = myVariable + " " + anotherVariable;
document.write(finalResults);
// -->
</script>
</body>
8. Save the file and close it.
9. Open the file in a browser. You should see the string "Hello AspDotNetHelp" displayed in the browser.
- C#.Net interview questions and answers
- Working with enterprise library for data access in asp.net Part-3
- Get nth highest lowest salary in SQL Server 2008
Concatenation refers to the act of combining two text strings into one longer text string.
1. Open a new HTML document in your preferred HTML or text editor.
2. Create the body of the document with opening and closing body tags:
<body>
</body>
3. Insert a script block in the body of the document:
<script language="JavaScript">
<!--
// -->
</script>
4. Create a variable named myVariable and assign the value "Hello" to it:
var myVariable = "Hello";
5. Create a second variable named anotherVariable and assign the value "there" to it:
var anotherVariable = "AspDotNetHelp";
6. Concatenate the values of myVariable and anotherVariable, along with a space between them, and assign the results to a third
variable named finalResults:
var finalResults = myVariable + " " + anotherVariable;
7. Display the results so that the final page looks like below
<body>
<script language="JavaScript" type="text/javascript">
<!--
var myVariable = "Hello";
var anotherVariable = "AspDotNetHelp";
var finalResults = myVariable + " " + anotherVariable;
document.write(finalResults);
// -->
</script>
</body>
8. Save the file and close it.
9. Open the file in a browser. You should see the string "Hello AspDotNetHelp" displayed in the browser.