Front-end basic-javascript sixth day

Source: Internet
Author: User
Tags setinterval

Button not available

Button can not be used disabled not be able to use the meaning

btn.disabled = "Disabled" | | Btn.disabled = true;

Grey

Attention:

    1. Because the button is a double label, you want to change his value, using InnerHTML, not value.
    2. Turn off timer clearinterval (timer name); The timer is no longer
SetTimeout of the timer ()

SetInterval (fn,5000); each interval 5 seconds, go to execute function fn One time

SetTimeout (fn,5000); after 5 seconds, go to the FN function and execute only once

A deeper view of the timer difference

SetInterval is queued for execution.

1 seconds, and the time of the executed program is 2 seconds     The last code that was not executed is queued is executed immediately. This is the actual execution interval of 2 seconds

The SetTimeout delay time is 1 seconds , and the code to execute takes 2 seconds to execute , The last time the code is executed is 3 seconds .

operator

Unary operator + +, ---+-+5-6

logical Operators ! && | |

basic operator +,-, *,/,%

relational operator , <, >=, <=, = = =, =,! =,!==

= value = = = = = = = =

conditional operator (ternary operator) ? :

assignment operator + =,-=, *=,/=,%=

A+=5 A= A + 5

comma operator , var a=0,b=0;

String Object Common method conversion to string

1. + "" "" "" "=" 2 "" "AB" = "2ab"

2. String () conversion to Strings

3. ToString(base) ; Cardinality is the binary

var txt = 10;

Txt.tostring (2) binary 1010

get character position method

CharAt, gets the corresponding position character (argument: character position)

charCodeAt get the corresponding position character Unicode encoding (parameter: Character position)

  1. button not available disabled = "Disabled" | | True
  2. SetTimeout only executes once setinterval executes many times
  3. Recursive invocation : The function calls itself function recursive call does not advocate the function name But like to use the Arguments.callee return is executing functions itself
  4. logical Operators   with && or | |          No! ! > && > | |
  5. 2&&0 0 1&&8 0&&3 0 1| | 0
  6. converted to Character Type
    var num = 12345;
    num+ ""
    String (num);
    Num.tostring (); Ten- Step system
    Num.tostring (2) binary
  7. returns characters based on character position
    CharAt ( index number )

var txt = "ABCDE";

Txt.charat (3); D

charCodeAt (3) Unicode encoding

Front-end basic-javascript sixth day

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.