en
Kyle Simpson

You Don't Know JS: Up & Going

Giv mig besked når bogen er tilgængelig
Denne bog er ikke tilgængelig i streaming pt. men du kan uploade din egen epub- eller fb2-fil og læse den sammen med dine andre bøger på Bookmate. Hvordan overfører jeg en bog?
Denne bog er ikke tilgængelig i øjeblikket
134 trykte sider
Har du allerede læst den? Hvad synes du om den?
👍👎

Citater

  • bsvmbo1o qolhar citeretfor 2 år siden
    perators are how we perform actions on variables and values.

    We’ve already seen two JavaScript operators, the = and the *.

    The * operator performs mathematic multiplication. Simple enough, right?

    The = equals operator is used for assignment—we first calculate the value on the right-hand side (source value) of the = and then put it into the variable that we specify on the left-hand side (target variable).

    This may seem like a strange reverse order to

    specify assignment. Instead of a = 42, some

    might prefer to flip the order so the source value

    is on the left and the target variable is on the

    right, like 42 -> a (this is not valid JavaScript!).

    Unfortunately, the a = 42 ordered form, and

    similar variations, is quite prevalent in modern

    programming languages. If it feels unnatural,

    just spend some time rehearsing that order in

    your mind to get accustomed to it.
  • bsvmbo1o qolhar citeretfor 2 år siden
    Expressions
    Statements are made up of one or more expressions. An expression is any reference to a variable or value, or a set of variable(s) and value(s) combined with operators.

    For example:

    a = b * 2;

    This statement has four expressions in it:

    • 2 is a literal value expression.

    • b is a variable expression, which means to retrieve its current value.

    • b * 2 is an arithmetic expression, which means to do the multiplication.

    • a = b * 2 is an assignment expression, which means to assign the result of the b * 2 expression to the variable a (more on assignments later).

    A general expression that stands alone is also called an expression statement, such as the following:

    b * 2;

    This flavor of expression statement is not very common or useful, as generally it wouldn’t have any effect on the running of the program —it would retrieve the value of b and multiply it by 2, but then wouldn’t do anything with that result.

    A more common expression statement is a call expression statement (see ), as the entire statement is the function call expression itself: alert( a );

På boghylderne

  • Dante
    Code
    • 19
  • Оксана Бойко
    Javascript
    • 6
fb2epub
Træk og slip dine filer (ikke mere end 5 ad gangen)