an infinity is a number:Instance
var x = 1000 / 0;isNaN(x); // returns false
A number can be a number or an object.Numbers can be initialized with private data, just as x = 123;JavaScript numeric object initialization data, var y = new Number (123 );Instance
var x = 123;var y = new Number(123);typeof(x) // returns Numbertypeof(y) // returns Object
Instance
var x = 123; var y = new Number(123);(x === y) // is false because x is a number and y is an object.
JavaScript String objectThe Strin
The following data types are defined in javascript:
Strings (String)
Numbers (number)
Boolean (Boolean)
Arrays (Array)
Objects (object)
Null (NULL)
Undefined (Undefined)
1. StringA string is any text enclosed in single quotation marks ' or double quotation marks:var carname= "Volvo XC60"; var carname= ' Volvo XC60 ';If it ‘ is also a character, it can be "" enclosed:var
an underscore _.4. Data types in JS (remember)The ①undefind is not assigned, and the variable declared with VAR has been used but is not assigned a value.②nall represents an empty referenceThe ③boolean boolean type. True Ture, Flase.④number numeric type, can be an integer, can be a decimal,⑤string string type, with "" or "package⑥object Object TypeJavaScript Data TypesUse the VAR keyword to declare the variable:var carname;After the variable declaration, the variable is empty (it has no value).
Because of the university curriculum, the teacher giant love ask questions, also score, casually record JS learning situation, later review what is more convenient bar ...Start, just follow the C language to learn the way to it!================================== cut and cut ==================================1. Data type (This is just a bit of a mention)1 /*2 I think there is no obvious data type in JS, only String, number, Boolean, array, object, Null, Undefined3 */4 5 vartemp = ' legth '6 7 var
1. Manipulating HTML elementsIf you want to access an HTML element from JavaScript, you can use the document.getElementById (ID) method.Use the ID property to identify the HTML element:Example:Access the HTML element with the specified ID and change its contents:2. ArraysThe following code creates an array named cars:var cars=new Array (); cars[0]= "Audi"; cars[1]= "BMW"; cars[2]= "Volvo";or (condensed array):var cars=new Array ("Audi", "BMW", "
.2.1JavaScript Code SpecificationCode specifications typically include the following:
Naming rules for variables and functions
Whitespace, indentation, usage rules for annotations.
Other common specifications ...
The code of the specification can be easier to read and maintain.Code specifications are generally defined prior to development and can be negotiated with your team members to set up2.2 Variable NameThe name of the variable is recommended using the Hump method (Cam
propertiesMax_valueMin_valueNegative_infinityPositive_infinityNaNPrototypeConstructorDigital methodToexponential ()ToFixed ()Toprecision ()ToString ()ValueOf ()JavaScript strings (String) objectA String object is used to handle an existing block of characters.JavaScript stringA string is used to store a series of characters like "John Doe".A string can use either single or double quotation marks:Instancevar carname= "Volvo XC60";var carname= '
JavascriptString Object
A String object is used to handle an existing block of characters.
JavaScript stringA string is used to store a series of characters like "John Doe".A string can use either single or double quotation marks:Example var carname= "Volvo XC60";var carname= ' Volvo XC60 ';You use the location (index) to access any character in the string:Example Var character=carname[7];The in
figure out when and how it happens. At this time, we can use console.trace to debug JavaScript.For example, if you want to see the entire stack details under a car instance funcZ :
var car;var func1 = function () { Func2 ();}var Func2 = function () { Func4 ();}var func3 = function () { }var Func4 = function () { Car =new Car ();Car.funcx ();}var Car = function () { This.brand = ' Volvo '; this.color = ' red '; This.funcx = function
any values.Five, string and integer1) The string is a sequence of characters, such as "Hello world!".The string can be any text within quotation marks. You can use single or double quotation marks:2) IntegerPHP Var_dump () returns the data type and value of the variableResults:int (5985) int ( -345) int (+) int (39)Six, array$cars =array ("Volvo", "BMW", "SAAB"); Var_dump ($cars);Results:Array (3) {[0]=> string (5) "
interpretation. As pictured, the parcel was just in Hawaii, the finger swept into New York, is it soon? The so-called Fingertips Express home. This type of creativity is simple and interesting, and many businesses are happy to use it, such as the following case.
Volvo collision-avoidance mobile creative advertising → http://www.56.com/u65/v_MTEwMjkwNjMw.html
Volvo is known for its safety, a
First of all, let's talk about why digital photos are late. Many photography beginners feel that the better the camera, the less the later, the better the photographer's shooting technology is not needed later, in fact, these two views are not entirely correct. Mainly due to the digital camera photosensitive principle of congenital deficiencies, electronic sensors in terms of latitude do not compare with the chemical film, it is often felt that digital photos are often not enough real, lack of l
the end of the statement, and by using semicolons, you can write multiple statements on one line.
6.Rules for JavaScript variable names:Variable is case sensitive (Y and Y are two different variables)Variable must start with a letter or underscore
7.Declaration of variablesIf the variable you are assigning has not been declared, the variable is declared automatically.Cases:x=5; Carname= "Volvo";The same effect as the following statements: Var x=5;
variable, use the equals sign:1 carname= "Volvo";However, you can also assign a value to a variable when you declare it:1 var carname= "Volvo";Declarations can also span multiple lines:1 var name= "Gates",2 age=56,3 job= "CEO";View CodeIn computer programs, variables that are not valued are often declared. A variable that is not declared with a value, whose value is actually undefined.Afte
1,javascript is a lightweight programming language that is a programming code that can insert HTML pages.2, start with tag.3, reference the script file with the extension. js in the external file 4, only Var can be used to declare variables, variables must start with a letter, variable names are case sensitive (Y and y are different variables), and many variables are declared in one statement. The statement starts with VAR and separates the variables with commas.To re-declare the JavaScript var
in PHP, there are two basic output methods: Echo and Print. In this tutorial, we'll use echo and print in almost every example. Therefore, this section provides you with more knowledge about these two output statements. PHP Echo and Print statementsThe difference between Echo and print:
echo-capable of outputting more than one string
Print-only one string is output and always returns 1
Tip: Echo is slightly faster than print because it does not return any values. PHP Echo Stat
Var and can be assigned at the same time when declaring. var pi=3.14; var name= "Bill Gates"; var answer= ' Yes I am! ' ; // You can also declare many variables in a statement var name= "Gates", age=56, job= "CEO"; // Declare a undefined variable var carname;9) JS data type//JS has a dynamic typevarX//x is undefinedvarx = 6;//x is a numbervarx = "Bill";//x is a string//JavaScript has only one numeric type. Numbers can be taken with decimal points or without. varx1=34.00;//use a decimal
.
[4] variables are case sensitive
[5] identifiers should adopt the small hump format, and the first should be the data type. Common identifiers are as follows:
Array a Array aItemsBoolean value B Boolean bIsCompleteFloating Point f Float fPriceFunction fn Function fnHandlerInteger I Integer iItemCountObject o Object oDIv1Regular Expression re RegExp reEmailCheckString s String sUserNameVariable v Variant vAnything
1.3 variable DeclarationDeclaration format: var variable name;
Var num; // decla
JavaScript variable, the value of the variable is not lost:After the following two statements are executed, the value of the variable carname remains "Volvo":var carname= "Volvo"; var carname;JavaScript has a dynamic typeJavaScript has a dynamic type. This means that the same variables can be used for different types:Instancevar x //x is Undefinedvar x = 6; //X is the number var x
();
In PHP, there are three types of arrays:
Numeric array-an array with a numeric ID key
Associative array-An array with the specified key, with each key associated with a value
Multidimensional arrays-An array that contains one or more arrays
PHP Numeric Array
Here are two ways to create a numeric array:
Auto-Assign ID key (ID key always starts from 0):
$cars =array ("Volvo", "BMW", "Toyota");//Manually Assign ID key: $cars [0]= "
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.