164 captures
19 Jun 2006 - 14 Dec 2025
Sep OCT Nov
27
2019 2020 2021
success
fail

About this capture

COLLECTED BY

Collection: Common Crawl

Web crawl data from Common Crawl.
TIMESTAMPS

The Wayback Machine - http://web.archive.org/web/20201027075053/https://simple.wikipedia.org/wiki/Javascript
 





JavaScript



From Simple English Wikipedia, the free encyclopedia

(Redirected from Javascript)


Jump to navigation  Jump to search  

JavaScript is a high-level programming language. It was originally designed as a scripting language for websites but became widely adopted as a general-purpose programming language, and is currently the most popular programming language in use[1]. JavaScript is usually found running in a web browser as interactive or automated content, ranging from popup messages and live clocks to large web applications. JavaScript is also commonly used in server-side programming through platforms like Node.js[2], or "embedded" in non-JavaScript applications where the base programming language lacks the high-level functionality that JavaScript offers.

Despite the similarities in name and syntax, JavaScript is not related to the programming language Java. Though the names of both languages are trademarksofOracle Corporation, the two languages follow different design principles, and are actively developed by unrelated organizations.

Use[change | change source]

JavaScript is typically inserted into HTML when used on the web, either directly in the file in a HTML tag, or linking it to a separate file containing the script.

JavaScript, as a full featured scripting language, can be used to provide functionality to a website. Examples include:

Frameworks[change | change source]

A majority of websites use what is known as a framework. Frameworks may allow programming to be easier as more predefined procedures are defined within it. Such a library is jQuery.

Beyond web browsers[change | change source]

JavaScript is also used outside of web browsers. As a scripting language, JavaScript can be used to define the behaviour of applications such as extensions in GNOME Shell.

In addition, there are runtime environments for running JavaScript as a server side programming language. Such an environment is Node.js.

Electron is a framework which allows graphical applications to be made with web technologies, by running on the Chromium browser and Node.js.

Syntax[change | change source]

A JavaScript program is made of a collection of instructions called "statements". A semicolon marks the end of a statement, and allows multiple statements to be placed on the same line. However, it is typical to write each statement on its own line to keep a program file readable.

Variables can be defined in several ways. In an older version named "ES5", variables are defined using the var keyword.[3] In the newer versions after ES5, variables can be defined using const for constant variables and let for local variables.[4][5] The value of constant variables cannot be re-declared or reassigned. Variables assigned using constorlet are contained within blocks, while variables assigned using var are contained within functions.

1// ES5
2var x = 1;
3
4// ES6+
5const y = 10;
6let t = 5;

Examples[change | change source]

The script below prints "Example" on the screen. The lines that start with // are comments, which are used to describe the actions of the program.[6]

function sayHi() {
    let name = prompt("What's your name?"); 
    // this name is saved to a variable
    
    alert("Hello " + name);
    // whatever the name is, the browser alerts "hello (name)"
    // a variable was used (name)
}

sayHi(); // Runs the function sayHi

/*  This is also a comment, but it can span multiple lines.
    Like this.
*/

In the above code it says "Hello " + name

If you want to put JavaScript in your HTML is, you put between the <script></script> tags. The tags indicate that it is a script and not text to be put onto the web page. The script below inserts the numbers 1 through 10 at the bottom of a webpage:

<!DOCTYPE html>
<head>
    <title>Example page</title>
    <script> // This is the script tag

    for (let counter = 1; counter <= 10; counter++) {
        document.body.innerHTML = document.body.innerHTML + counter + "<br>";
        
        /*
            This puts the number, then a new line element (<br>),
            at the end of the web page.
        */
        
    }

    // End javascript: </script>
</head>
<body></body>

The for() loop makes whatever code is between the { and the } happen more than one time. In this case, it keeps looping until numOfTimesAround is equal to 10, then it stops. This means it equals ten. It's a bit confusing at first, but it works.

Differences between Java and Javascript[change | change source]

function sayHi() {
    alert("Hi!");
}

sayBye = function() {
    alert("Bye!");
}

sayHi();
sayBye();

Related pages[change | change source]

References[change | change source]

  1. "Stack Overflow Developer Survey 2019". Stack Overflow. Retrieved 2020-03-11.
  • "Server-Side Javascript: Back With a Vengeance". ReadWrite. 2009-12-17. Retrieved 2020-03-11.
  • "var". MDN Web Docs. Retrieved 2018-03-24.
  • "const". MDN Web Docs. Retrieved 2018-03-24.
  • "let". MDN Web Docs. Retrieved 2018-03-24.
  • [1]
  • Other websites[change | change source]


    Retrieved from "https://simple.wikipedia.org/w/index.php?title=JavaScript&oldid=7085382"

    Categories: 
    JavaScript
    Programming languages
    Internet
    Web design
    Hidden category: 
    Technology stubs
     





    Navigation menu


    Personal tools  



    Not logged in
    Talk
    Contributions
    Create account
    Log in
     

    Namespaces  



    Page
    Talk
     

    Variants  





    Views  



    Read
    Change
    Change source
    View history
     

    More  





     






    Getting around  



    Main page
    Simple start
    Simple talk
    New changes
    Show any page
    Help
    Contact us
    Give to Wikipedia
    About Wikipedia
     

    Tools  



    What links here
    Related changes
    Upload file
    Special pages
    Permanent link
    Page information
    Cite this page
    Wikidata item
     

    Print/export  



    Make a book
    Download as PDF
    Page for printing
     

    In other projects  



    Wikimedia Commons
     

    In other languages  



    Afrikaans
    Ænglisc
    العربية
    Asturianu
    Azərbaycanca

    Bân-lâm-gú
    Беларуская
    Беларуская (тарашкевіца)
    Български
    Català
    Чӑвашла
    Čeština
    Dansk
    Deutsch
    Eesti
    Ελληνικά
    English
    Español
    Esperanto
    Euskara
    فارسی
    Français
    Galego
    /Hak-kâ-ngî

    Հայերեն
    ि
    Hrvatski
    Bahasa Indonesia
    Interlingua
    Íslenska
    Italiano
    עברית
    Jawa

    Қазақша
    Kiswahili
    Кыргызча
    Latviešu
    Lietuvių
    Lingua Franca Nova
    Lumbaart
    Magyar
    Македонски


    مصرى
    مازِرونی
    Bahasa Melayu
    Mìng-dĕ̤ng-nḡ
    Монгол

    Nederlands


    Nordfriisk
    Norsk bokmål
    Oʻzbekcha/ўзбекча
    پنجابی

    Polski
    Português
    Română
    Русский
    Саха тыла
    Scots
    Shqip

    Slovenčina
    Slovenščina
    کوردی
    Српски / srpski
    Srpskohrvatski / српскохрватски
    Sunda
    Suomi
    Svenska
    Tagalog
    ி
    Taqbaylit
    Татарча/tatarça

    Tetun

    Тоҷикӣ
    Türkçe
    Türkmençe
     
    Українська
    اردو
    Vèneto
    Tiếng Vit



    Žemaitėška


    Change links
     



    This page was last changed on 28 August 2020, at 02:53.

    Text is available under the Creative Commons Attribution/Share-Alike License and the GFDL; additional terms may apply. See Terms of Use for details.



    Privacy policy

    About Wikipedia

    Disclaimers

    Mobile view

    Developers

    Statistics

    Cookie statement



    Wikimedia Foundation
    Powered by MediaWiki