0% found this document useful (0 votes)
28 views2 pages

To Concatenate Strings, Simply Use A + Sign With Two Variables of Strings

Javascript is a client-side scripting language that is executed in web browsers to create dynamic and interactive content. It uses the browser to execute code as the page is processed, unlike server-side languages. To concatenate strings in Javascript, use the + operator between two string variables. Variables do not require explicit declaration of data type in Javascript and are declared using the var keyword followed by the variable name. Functions can be defined in Javascript to perform reusable tasks and are called using the function name.

Uploaded by

Joseph Jeremy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views2 pages

To Concatenate Strings, Simply Use A + Sign With Two Variables of Strings

Javascript is a client-side scripting language that is executed in web browsers to create dynamic and interactive content. It uses the browser to execute code as the page is processed, unlike server-side languages. To concatenate strings in Javascript, use the + operator between two string variables. Variables do not require explicit declaration of data type in Javascript and are declared using the var keyword followed by the variable name. Functions can be defined in Javascript to perform reusable tasks and are called using the function name.

Uploaded by

Joseph Jeremy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

REVIEWER-ICT To concatenate strings, simply use a + sign with two

variables of strings.
JAVASCRIPT SELF LEARNING
++ increment operator
Javascript - client side scripting language when a user
goes to a website, the web server will send an HTML file Var num = 6
back to the user and it will include the Javascript code. Document.write(num++) // this will
still output 6
It uses browser then execute code when it is processing // it will still be read as num
the page. Document.write(num) // this time it
will increment na
In contrast with server side it is a language that will not
send the code to the user but just shows the output of
Another example:
the code.
Var num = 7
What is the difference of Javascript from Java?
var next = ++num;
document.write(next)
Javascript has many uses including form validation,
effects on a webpage and interactive content. strings have some internal properties like length of the
string
Html or htm file extension is good

You put javascript in a <script> tag you can get the length by variablename.length
To print something you could use ex.
Document.write
Var abc = “ABCDEFG”
Var result = abc.length
We start with variables.
Variable – has name and a value OUTPUT:
7
Var keyword
You can also get the subelements of the whole string by
In other languages, when you declare a variable, you this syntax
need to declare the variable type. Ex. Int var. //example – we only want to get DE
Var abc = “ABCDEFG”
But in javascript, you don’t do that. Var result = abc.substring(3,5)

You just declare var keyword. OUTPUT:


DE
Ex.
Var myvariable = false; If we set the starting point of the range as 0, will output
Var myvariable = 5; to ABCDE
Var my variable = “asdfa” Note. 0 element – A
But still the count for the last range E = 5

To put comments use // ARRAYS - holds many values


Commonly used in for loops

CONCATENATION
To declare an array

Var a = new Array(7);

Or much simpler, use bracket instead

Var a = [“dog”, “cat”]

DEFINING FUNCTIONS

If you have functions that you want to reuse.

You can call functions as many times as you want

<script>
function methodName() {
document.write(“<br>”);
methodName(“Mary”);
}
</script>

Possible: you can call the methondName() over and over


again. You can call it within another tag
Ex. You placed it inside the head tag

You can recall the function inside the body tag

Alert() method – a methd that gives you a dialog box

LOOPS

Review “for” loop

For(declaration;condition;increment)

You might also like