Professional Documents
Culture Documents
To Concatenate Strings, Simply Use A + Sign With Two Variables of Strings
To Concatenate Strings, Simply Use A + Sign With Two Variables of Strings
To Concatenate Strings, Simply Use A + Sign With Two Variables of Strings
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)
CONCATENATION
To declare an array
DEFINING FUNCTIONS
<script>
function methodName() {
document.write(“<br>”);
methodName(“Mary”);
}
</script>
LOOPS
For(declaration;condition;increment)