DEV Community

Mitleo
Mitleo

Posted on

Introduction to Javascript

INTRODUCTION

This language is the popular language in web developments.
javascript is mainly used to decide how web pages will behave.

Syntax

  • statements are separated using semicolon (;)
    example
    x= 5;
    y=3;
    let a =x+y ;

  • comments doesn't allow execution of unnessary statements. they are shown with (//)
    examples

Image description

  1. variables in Javascript variables are containers for storing data or data values. ways to declare variable include;
  • using the keyword var commonly used and it does not have the restrictions that other keywords have. Image description
    • using the keyword let used for declaration of block-level variables. Image description
    • using the keyword const used for declaration variables whose values are might change Image description
    • using nothing

Image description

  1. Data types of Javascript
  • String- the data type is mainly used to represent textual data and is created using single or double quotes surrounding one or more characters. example

Image description

  • Number - used to represent positive or negative numbers with or without decimal place, or numbers written using exponential notation

Image description

  • Boolean- the data type can hold only two values: true or false. The Boolean values also come as a result of comparisons in a program.

Image description

  • Object- they are variables which contain more than one value example of a person as shown.

Image description

Top comments (0)