Close Menu
    Facebook X (Twitter) Instagram
    Oixiesoft
    • Home
    • Services
      • WordPress Malware Removal
      • Fix WordPress Errors
      • WordPress Website Development
    • Articles
    • Contact
    Oixiesoft
    Home»Tutorial»JS»JS Basics
    JS

    JS Basics

    Editorial StaffBy Editorial StaffUpdated:May 14, 2022No Comments2 Mins Read
    Share
    Facebook Twitter LinkedIn Pinterest Email

    JavaScript basics

    In this lesson, we examine some basic JavaScript concepts such as how to add JavaScript expressions, semicolons, and more.

    A JavaScript program is a list of instructions that you give to the computer for execution.

    If you tell the computer “add two plus four and print the result” the computer will calculate 2 + 4 and print 6.

    The browser’s interpreter is in charge of “executing” your JavaScript code. Web browsers have what is called a JavaScript interpreter.

    This interpreter will read your JavaScript statements and then interpret and execute them one line at a time.

    Semicolons

    Use the semicolon (;) to indicate to the JavaScript interpreter that you finished writing the current code statement.

    It’s an instruction telling the interpreter about the end of the current statement and the beginning of a new one.

    var num1 = 10; 
    var num2 = 20;
     var result = num1 + num2; console.log(result);
    

    JavaScript statements and values

    A JavaScript statement is a code that contains Values, Expressions, Keywords, Operators, and Comments

    JavaScript has two types of values.

    1. Fixed values

    The first type is fixed values, also called literals. Because they are fixed values, they cannot change.

    Literals can be of any of the following types:

    • Array,
    • Boolean,
    • Integers,
    • String, etc.

    Literals Example

    // Literals
    "5" + "6" + "7"; // String literal
    5 + 6 + 7; // Integer literal
    

    Array literals Example

    // Array literal
    var carModels = ["BMW", "Mercedes", "Audi"];
    

    2. Variable value

    The second type of value found in JavaScript is a variable value, also called variables. Variables can change, but literal values remain fixed and cannot change.

    A JavaScript variable is declared with the keyword var, and the equals sign is used to assign a value to a variable.
    You can cover JavaScript variables later on in this JavaScript tutorial.

    Variables Example

    // Variables
    var myVariable = 15;
    myVariable = 20;
    console.log(myVariable);
    
    Share. Facebook Twitter Pinterest LinkedIn WhatsApp Reddit Tumblr Email
    Editorial Staff

    Related Posts

    CodeIgniter vs Laravel: A Detailed Side-by-Side Comparison

    Python Arrays

    Python Lambda

    Services
    • Web Development
    • Mobile Application Development
    • WordPress Malware Removal Service
    • Website Design
    • WordPress Development
    • Magento Development
    • Shopify Development
    • SEO Services
    Blog
    • How to Fix the Error Establishing a Database Connection
    • Ping List WordPress
    • How To Fix Japanese Keyword Hack
    • How to remove Malware from WordPress
    Hire Developers
    • Hire WordPress Developer
    • Hire Shopify Developer
    Contact Info
    • Oixiesoft Technologies
      A-40, Block A, I thum Tower, Sector 62, Noida
    • [email protected]
    • Privacy Policy
    • About Us
    • Contact Us
    © 2025 OixieSoft Technologies

    Type above and press Enter to search. Press Esc to cancel.