JavaScript Learning Notes Collation _ About expressions and statements _ basics

Source: Internet
Author: User

Expressions and statements

Eval () has only one parameter

parameter is not a string, this parameter is returned directly;

When the parameter is a string, it compiles the string as JavaScript code, throws a syntax error when the compilation fails, executes the code when the compilation succeeds, returns the value of the last statement, and returns undefined if there is no value

Eval () uses the scope environment of the variable that called it

The string parameter it receives must be semantically when used as a separate code, otherwise the compilation fails

Delete Operator: An element that deletes an object's free properties, an array,

When a property is deleted, the property does not exist, and after the array element is deleted, a hole with a value of undefined is left in the array, and the length of the array remains unchanged;

Attempt to delete a property that cannot be deleted returns False if the delete succeeds or the delete operation does not work, returns true

Delete cannot be deleted:

1, built-in core, client properties can not be deleted;

2, the user declared through the VAR statement can not delete the variable;

3. Functions and function parameters defined through function statements cannot be deleted

4. Properties that cannot be configured cannot be deleted

void operator: The operand of void executes normally, but ignores the value of the operand and returns the undefined

Void has the following effects:

* The use of void 0 to undefined than the use of the literal undefined more reliable and safer;

* The filled <a> href ensures that the page jumps are not generated when clicked; Fill <image> src to ensure that no garbage requests are made to the server. href= ' javascript:void (0); '

The break statement does not have control over the bounds of the function, regardless of the label. That is, you cannot jump from inside a function to outside the function

Object.create (P, [x])

The method creates a new object with the object p as its prototype, and returns the object, and optionally x is used to further describe the object's attributes;

var p1 = object.create (p); New Object P1, which inherits from Object P (prototype with P)

That is, the value of the prototype (prototype) property of P1 is P

The difference between p.x and p[' x ':

p.x access, you can only fixed access to properties with the property name X;

and p[' x ' is more flexible and can dynamically modify the value of the string within [] to access different properties, such as p[' X ' +i]

Logic and "&&", logic or "| |" The magical action: short circuit behavior

By &&, the book and Book.subtitle are true values before the Length property is read, which is the object

var len = Book && book.subtitle && book.subtitle.length;

The value of the guarantee X is: From the A~f, the first is the value of the truth, ignoring the truth of the following

var x = a | | B | | C | | D | | e | | F

if (! Buy) {...} when Buy is a false value, execute {...}

Pass!! X to get an equivalent Boolean value.

The above is a small series for everyone to bring the JavaScript learning notes on the expression and the full content of the sentence, I hope to help you, a lot of support cloud Habitat Community ~

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.