Font size
WorksheetsJavaScript - Introduction
Total questions: 13
Worksheet time: 41mins
Hello Programmers! Say HI!
(a)
JavaScript is the most used language since 1990s, what is JavaScript used for?
A language used for app
A language to create interactive web elemets
A language to make a web app
A most used language since 1990s
JavaScript has also a library called "JavaScript Library" where you can find more active elements that can be found from internet, for that reason, what is the short variable name of JavaScript
JS
JSPT
Sp
jsp
Variable - Variables are containers for storing data values. The value of a variable can change throughout the program. Declaring a variable is as simple as using the keyword var. Which would look like what?
var x =(10)
Var X ="10"
VAR="X10"
var x ="10"
In this example we’ve assigned a value of 10 to the variable x. We’ve used the word assigned deliberately here, because in JavaScript, the equal sign (=) is actually called the "assignment" operator, rather than an "equal to" operator. Which means that in JavaScript, x = y will assign the value of y to x variable.
Okay
Okay
Heads up! JavaScript is sensitive, case sensitive that is. So variables like lastName and lastname are not the same.
Ok, let’s put some of what we’ve learned together! How about we assign a value to a variable and output it to the browser. We’ve got this!
But what’s the point of variables anyway? Well, imagine your program has 1000 lines of code that include the variable x. With variables you can change the value of the variables and use them multiple times in your code like?
var x ="10";
document.write=(X);
x ="42"
document.write=(X)
Let’s talk about names. It’s super important to remember that JavaScript variable names are case-sensitive. What do you think the output of the following code would be?
Comments - Great stuff! You’ll soon be a variable master. Ok, let’s talk about comments in JavaScript. So we know about statements, these are the instructions within our program that get "executed" when the program runs. But! Not all JavaScript statements are "executed". Any code after a double slash //, or between /* and */, is treated as a comment, and will be ignored, and not executed. To write a Single line comment we use double slashes.
What should be your comment? right it down here! JS only
Type
This is a comment
In your comment
(a)
Alert box - Heads up! alert() is used to create a message box.
Create an alert box using "alert" "prompt" "confirm" choose 1 only,
Type:
(a) ("Your alert sign here");
Soon - Data Type
Thanks for answering this question by JavaScript Basic
