Operator Precedence and associativity in JavaScript

Operator Precedence

Operator precedence determines the order in which operators are evaluated when more than one operator is used in an expression.

The higher an operator’s precedence, the earlier it is evaluated in comparison with the operators with lower precedence.

Consider the following example:

The above expression is evaluated in the order of the multiplication operator (*) at first, then the plus operator (+), and finally, the assignment operator (=), due to their respective precedence order.

Precedence can also be manually overridden using a parenthesis e.g.,

The above mentioned expression has its parenthesis around the plus operator, which alters the precedence thereby evaluating the addition operation first.

Operator Associativity

Associativity determines the way in which the operators having same precedence are parsed e.g.:

Left-associativity (left to right) denotes that it is processed as (a <operator> b) <operator> c, while right-associativity (right to left) denotes it is interpreted as a <operator> (b <operator>c).

Assignment operators are right-associative i.e.,

Here both a and b get the same value 5.

At first, b is set to 5.

Then a is also initialized to 5 i.e., the return value of b = 5(right operand of the assignment).

Operator Precedence Table

In the following table, the highest precedence refers to 20 and to the lowest to 1.

Precedence Operator type Associativity Individual operators
20 Grouping n/a (…)
19 Member Access (dot operator) left-to-right … . …
Computed Member Access left-to-right … [ … ]
new (with argument list) n/a new … ( … )
Function Call left-to-right … ( … )
18 new (without argument list) right-to-left new …
17 Postfix Increment n/a … ++
Postfix Decrement … —
16 Logical NOT right-to-left ! …
Bitwise NOT ~ …
Unary Plus + …
Unary Negation – …
Prefix Increment ++ …
Prefix Decrement — …
typeof typeof …
void void …
delete> delete …
await await …
15 Exponentiation right-to-left … ** …
14 Multiplication left-to-right … * …
Division … / …
Remainder … % …
13 Addition left-to-right … + …
Subtraction … – …
12 Bitwise Left Shift left-to-right … << …
Bitwise Right Shift … >> …
Bitwise Unsigned Right Shift … >>> …
11 Less Than left-to-right … < …
Less Than Or Equal … <= …
Greater Than … > …
Greater Than Or Equal … >= …
in … in …
instanceof … instanceof …
10 Equality left-to-right … == …
Inequality … != …
Strict Equality … === …
Strict Inequality … !== …
9 Bitwise AND left-to-right … & …
8 Bitwise XOR left-to-right … ^ …
7 Bitwise OR left-to-right … | …
6 Logical AND left-to-right … && …
5 Logical OR left-to-right … || …
4 Conditional right-to-left … ? … : …
3 Assignment right-to-left … = …
… += …
… -= …
… **= …
… *= …
… /= …
… %= …
… <<= …
… >>= …
… >>>= …
… &= …
… ^= …
… |= …
2 yield right-to-left yield …
yield* yield* …
1 Comma / Sequence left-to-right … , …

HTML del tag

HTML del tag is used to represent set of characters deleted from the document. The characters inside the del tag are represented as text with centre line(text with strukethrough line).

Syntax:

Example:

Result:

Java StringTokenizer hasMoreElements() Method

This method checks for next token in StringTokenizer if the token exists then return true else return false. Work similar as
hasMoreToken()

Parameters

NA

Return

Return true if next token exists else return false

Example

Result

At starting object st is pointing before the first word(Java). on calling st.hasMoreElements it is checkin that the first word java is there so it is returning true.

MySql Update table column from another table colunm

Updating a table fields from another table columns we can user following syntax

There are two tables table1 and table2. Both table have common id value. To select appropriate field from table inner join in used and updating table1 fields from table2 fields set statement is used.

For example there are two tables with following fields
user(id,fname,lname,mobileno,address,);
personal(id,fname,lname,mobile_no);

Here c=consider user and person have common id then to update user from person we can use following query

This will update user table with person tables fields.

Nginx and tomcat server configuration

Algebraic expression

A combination of constant and variables connected by some or all at the the four fundamental operations, additions, substraction, multiplication & division is called an algabric expression
e.g- 3x + zy

Terms:- the different part of an algebraic expression separated by sign+ or – are called the terms of an expression.
e.g. 3x+2y (term – 3x & 2y)

factor of terms :- we can factroized all terms all terms.-
e.g 3x + 2y
3x = 3×x
2y = 2×y

Types of algebaric expressions.

Monomial– which contains only one term is said a monimial.
Ginomial– which contains two terms e.g. 3x + 2y
Trinomials– which contains three terms – e.g- 3x +2y +z
Quadrinomials – which contains four terms e.g. 2x + 3y + z-6
Polynomials– which contains one or more terms.

Degree of polynomials The highest power of the variable in a polynomials is called its degree.

x^{3}+3, \frac{1}{2}, y^3+1 Here the degree of the polynomial is 3

Linear polynomial– a polynomial of degree is called a linear polynomials. E.g.- x+3

Quadratic polynomials– a polynomials of degree 2 is called a quadratic polynomials.

E.g. (x+2)(x+3) = x2 + 5x + 6

Cubic polynomial– A polynomial of degree 3 is called cubic polynomials.
e.g. degree of the term- 3x =1
2xy = 1+1 = 2
3x2g = 2 = 1 = 3

Algebraic expressions contains one or more forms and each terms contain variable and numerical coefficient, we find the value of terms to put the value of variables.
Equation– a statement of equality which invader one or more variable is called an equation. Terms of left hand side is equal to right hand side e.g – 3x+5 = 8

Solution of an equation e.g. 3x+5=8

(1 )Trial & error method– put the value of variable x, so that L.H.S= R.H.S.
Put the value of x= 1,2,3 who satisfy by the equation
3(1)=5 =8 the value of x= 1 is satisfied equation

(2) (A) if same number or terms is added, substract multiply or divide to both side of equation , the equation remain same (elemination method)
3x+5=8
3x=3(deduct 5 in both side)
X=1 (divid from 3 in both side)
(B) change in the side of required terms.
3x+5= 8
3x= 8-5
3x=3
x = 3/3 = 1

Setting innodb_lock_wait_timeout

The length of time in seconds an InnoDB transaction waits for a row lock before giving up. The default value is 50 seconds. A transaction that tries to access a row that is locked by another InnoDB transaction waits at most this many seconds for write access to the row before issuing the following error:

When a lock wait timeout occurs, the current statement is rolled back (not the entire transaction).

to show default value of innodb_lock_wait_timeout we use

and for changing the value of innodb_lock_wait_timeout we use following command