0% found this document useful (0 votes)
2 views

1 Javascript Intro

About programming

Uploaded by

enobiodianne29
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

1 Javascript Intro

About programming

Uploaded by

enobiodianne29
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

LESSON 1: COMPUTER PROGRAMMING OVERVIEW

COMPUTER PROGRAM
A computer program is a sequence or set of instructions in a programming language for a computer to
execute.

PROGRAMMING LANGUAGE
A programming language is a way for programmers (developers) to communicate with computers.
Programming languages consist of a set of rules that allows string values to be converted into various ways of
generating machine code, or, in the case of visual programming languages, graphical elements.

TEXT EDITOR
A text editor is a type of computer program that edits plain text. Such programs are sometimes known as
"notepad" software.
DATA TYPES
A data type is a classification of data which tells the compiler or interpreter how the programmer intends to
use the data. Most programming languages support various types of data, including integer, real, character or string,
and Boolean.
Data Types Definition Sample Data
Integer Whole Numbers 16, 3, 5
Float Numbers with decimal points 2.1, 13.54
String Mix with characters, numbers and letters John, @password123
Boolean Value must contain only true or false True, False

VARIABLES
Variables are used to store information to be referenced and manipulated in a computer program.
Example;
var x = 3;

var y = 5;

var z = x + y;

Explanation:
• x, y and z are variable names that holds a specific value.
• We use the keyword var to define or declare a variable.

OPERATORS
An operator in a programming language is a symbol that tells the compiler or interpreter to perform specific
mathematical, relational or logical operation and produce final result.
Example:
var base = 3;

var height = 5;

var area = (base * height) / 2;

Explanation:

• Above sample uses some basic Arithmetic operators(* and /).


• Other Types of Operators
▪ Arithmetic Operators
▪ Assignment Operators
▪ Comparison Operators
▪ String Operators
▪ Logical Operators
▪ Bitwise Operators
▪ Ternary Operators
▪ Type Operators
WRITING YOUR FIRST JAVASCRIPT PROGRAM
Follow the step-by-step procedures.
[1] Create a folder in your desktop and name it “jsFiles”.

METHOD #1
[2] Open the Text Editor called SubLime. Using a computer

[3] Write the code below and save it your “jsFolder”. Name the file as “hello.js”.

[4] Check if the file was saved successfully in your jsFolder.


[5] We need to create another file called index.html in order execute our JavaScript program. Open again SubLime
text editor type the following code.

Note: We created the index.html file to link and execute our javascript program in a browser.

[6] Now open the index.html file to execute the hello.js program.
USING ANDROID APP TO WRITE AND EXECUTE JAVASCRIPT PROGRAM

[1] Download an install the app called JS Run.

[2] Open the app and test sample code.

METHOD #2
Using a mobile

You might also like