0% found this document useful (0 votes)
6 views1 page

001 - Introduction To JavaScript

JavaScript is a widely used programming language essential for creating interactive web elements. Key features include the use of <script> tags for code placement, the importance of semicolons for statement separation, and the use of variables and functions for storing and executing tasks. The document also introduces concepts such as assignment and concatenation, which will be explored in further lessons.

Uploaded by

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

001 - Introduction To JavaScript

JavaScript is a widely used programming language essential for creating interactive web elements. Key features include the use of <script> tags for code placement, the importance of semicolons for statement separation, and the use of variables and functions for storing and executing tasks. The document also introduces concepts such as assignment and concatenation, which will be explored in further lessons.

Uploaded by

kanaoshuri
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

INTRODUCTION TO JAVASCRIPT

JavaScript is one of the most popular programming languages in the world! The reason for this is that it is the most
common language used for web programming. Remember that HTML allowed us to structure the content in a webpage,
CSS allowed us to style and decorate the text, and JavaScript will allow us to create interactive elements, like buttons that
perform tasks, pop-ups that take inputs, and even animations and games!

Here is an example of a basic program.

IMPORTANT FEATURES

• Notice that the JS code is placed inside of the <script> tag. This tag can be placed in the <body> or the
<head>, or you can even import the code from a .js file. We will learn more about this in an upcoming lesson.

• There are two lines of JS code inside of the <script> tags. Notice that they both end with a semi-colon (;).
The semi-colon tells the browser to “do something” and is used to separate different statements. When JS runs, it
begins by executing the topmost statement in the block, and then moves on to execute each statement after, one at
a time.

• The keyword var is used to make a variable. We have named this variable name. A variable is a container we
use to store information in a program. That information can take the form of data such as numbers, words,
characters and more. We will learn more about variables in the next lesson.

• prompt() and alert() are called functions. Functions are basically commands that perform a certain task. JS
has many built-in functions already made for programmers to use, and in addition, you can create your own
functions to use in your programs! Functions can accept parameters, which are inputs the function uses. The
parameter for prompt() decides what message should be shown in the prompt window, where the parameter for
alert() decides what message should be displayed when the pop-up alert is shown. We will learn more about
functions in an upcoming lesson.

• Finally, the ‘=‘ is doing something interesting here. Instead of indicating equality, the ‘=‘ sign is performing an
assignment. This is how we store information in a variable. Also, the ‘+’ sign is used for addition, but in this
case, is actually connecting “Hello “ and name into one string, which is a sequence of characters. This is called
concatenation. We will discuss all of this in upcoming lessons!

You might also like