Monday, December 22, 2014

( Twenty Fourth Week ) November 10-14 :)

JavaScript 3!!



Hello JS3! We started doing our JS3 this week. We are about to tackle about this lessons.


JavaScript Operators and Expressions



Expressions - is any valid set of literals, variables, operators ans expressions that evaluates to a single value. This value can be a number, a tring or a logical value.

Operators - JavaScript has assignment, comparison, arithmetic, logical, string and special operators. There are binary and unary operators.



Assignment Operator assigns a value to its left operand based on the value of its right operand. The basic assignment operator is equal ( = ), which assigns the value of its right operand to its left operand. That is, x = y assigns the value of y to x. https://developer.mozilla.org/en-US/.../Operators/Assignment_Operator





The Precedence of The Operators If two non-assignment operators have the same precedence, they are evaluated from left to right. Thus y = 3+4+5; is evaluated as y = 7+5; or y = 12. Similarly, y = w*x/z is evaluated as y = (w*x)/z. If operators of a mixed precedence appear in an expression, the one with the highest precedence is performed from left to right, then the one with the second highest precedence is performed from left to right, and so forth. Thus z = 4/3 + 8%3 - 3; is evaluated as z = 1 + 2 -3; which is evaluated as z = 3-3; Similarly in if( a > b && c =< d), the expressions with the relational operators, a > b and c =< d, are evaluated first. Then, and only then, is the && used. cs.nyu.edu/courses/fall00/V22.0101-003/precedence.html




Types of Operators

Arithmetic operators take numerical values (either literals or variables) as their operands and return a single numerical value. The standard arithmetic operators are addition (+), subtraction (-), multiplication (*), and division (/). developer.mozilla.org › ... › Expressions and operators


Comparison Operators - JavaScript has both strict and type–converting comparisons. A strict comparison (e.g., ===) is only true if the operands are of the same type. The more commonly used abstract comparison (e.g. ==) converts the operands to the same Type before making the comparison. For relational abstract comparisons (e.g., <=), the operands are first converted to primitives, then to the same type, before comparison. developer.mozilla.org › ... › Expressions and operators



Logical Operators - 
  1. The concept of logical operators is simple. They allow a program to make a decision based on multiple conditions. Each operand is considered a condition that can be evaluated to a true or false value. Then the value of the conditions is used to determine the overall value of the op1operator op2 or !op1 grouping. www.cs.cf.ac.uk/Dave/PERL/node35.html
                      


And that's all for the week! Bye. :D

Thanks for reading! :)
Questions? Free to ask. :D

1 comment: