JS Review Basic grammar

Source: Internet
Author: User

Pop-up window:

  Alret ("What to Eject"); Don't make sure the page doesn't go down after it pops up.

  Confirm ("What to Eject"); OK dialog box, click OK to return True, point cancel returns false, available variables accept

 Prompt ("Hint text to display"); pops up a dialog box that allows you to enter content

Prompt ("Lose a number come in", "can only be a number");

  

Basic syntax

Basically consistent with C # syntax

break; jump out of the current loop

Continue; skip this cycle

Type conversions

   var a=parseint (value), other types converted to integers

var a=parsefloat (value), other types converted to integers

IsNaN (value); Determines whether a valid number is returned true is not a return false

      

<script>    var  A;    Prompt (" lose a number come in "" can only be a number oh ");     = IsNaN (); // put the input into isNaN ()    alert (a); // if it is a numeric bullet true, it is not a digital bomb false</script>


Four forms of the function (no specified type)

No parameter no return value

  test1 ();    function Test1 () {        alert ('hello');    }

No parameter has return value

There are no return values for parameters

<script>    test1 (5,6);    function Test1 (A, b) {        alert ('a+b');    } </script>

There are parameters with return values

<script>    var ccc = test1 (56);    Alert (CCC);    function Test1 (A, b) {        var c = a + b;         return c;    } </script>

JS Review Basic grammar

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.