JavaScript Basic Learning 2

Source: Internet
Author: User
Tags array definition

Output:

Window It is an object that represents the current browser window object

Window.document.write (); outputting content to the body tag

Window.alert (); is to pop a warning box to the browser's window

Console.log (); is to output the data in the browser's console

Window.prompt (); is a the browser's window pops up a input Box The user enters the data themselves.



The traversal of an array is mainly the use of three structures, especially loops.

Three types of structures:

Order, selection, cycle

Select:if

loops:for,while, do and

For....in statements can also iterate over an array

format:

For ( variable name in array name )

{

}


Array:

Array Definition: 1. var array variable name =[ element 1, element 2 .... element N]

2. var array variable name =new array ();


JS itself is not the concept of multidimensional arrays, because the type of array elements in JS can be any data type.

An array of elements inside it is an array!

How a two-dimensional array accesses an array element

format:

array variable name [Subscript of one-dimensional arrays ] [Subscript of two-dimensional array elements ];

Function:

Function: is the function that you need to implement is written in the content of the function, it can achieve the structure of modularity.

format: function name (parameter name 1, parameter name 2 ...)

{

content

}

calling Function: Function name (parameter name 1, parameter name 2 ...). )

the function name can be written without writing, rather than an anonymous function.

the invocation format of the anonymous function, (function(parameter name){}) (parameter name), the parameter name is not written.

parameters can also be not written, according to the need to determine whether to write.

If a parameter name is written, it participates in the actual argument. The arguments to the calling function are arguments, and the called function is the formal parameter.


JavaScript Basic Learning 2

Related Article

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.