java job --Day006

JavaScript Quiz

What is NaN, what type it is?

NaN (Not a Number, non number) is a numerical value in computer science data types, represents an undefined value or not expressed. Often used in the floating-point calculation.

Operations return NaN

Return NaN has the following three operations:
  • At least one parameter of operation is a NaN
  • Undefined formula
    • The following division: 0/0, ∞ / ∞, ∞ / -∞, -∞ / ∞, -∞ / -∞
    • The following multiplication: 0 × ∞, 0 × -∞
    • Adding the following: ∞ + (-∞), (- ∞) + ∞
    • Following subtraction: ∞ - ∞, (- ∞) - (-∞)
  • Generating a plurality of real number calculation results. E.g:
    • Even for a negative opening and operation of power
    • On the negative logarithmic operation
    • Logarithmic domain other than the sine or cosine reach arcsine, or inverse cosine operation
怎么测试一个值是否等于 NaN?
console.log(isNaN(NaN)); //true
console.log(isNaN(23)); //false
console.log(isNaN('ds')); //true
console.log(isNaN('32131sdasd')); //true
console.log(NaN === NaN); //false
console.log(NaN === undefined); //false
console.log(undefined === undefined); //false
console.log(typeof NaN); //number

 


MySQL quiz

drop, delete and truncate the difference?

The same point:
TRUNCATE, and the Delete to delete the data in the table will drop
different points:
1, TRUNCATE, drop a DDL statement is automatically committed after execution. delete DML statement is not automatically submitted.
2, delete (not free up space) and truncate (free space) deletes only the data without deleting the table structure. structure and data drop will delete tables, free up space.
3, speed: drop "truncate" delete


Java programming problem

A sequence Score: 2 / 1,3 / 2,5 / 3,8 / 5,13 / 8,21 / 13 ... and this calculated front 20 of the series.

public  class TL10 {
     public  static  void main (String [] args) {
         // definition of the sum of the denominator, molecules, temporary storage variable denominator   
        Double SUM = 0, H = 2, K =. 1, TEMP = 0 ;  
         for ( Double I . 1 =; I <= 20 is; I ++ ) {   
            sUM + = H / K;   
            TEMP = H;   
            H = H + K;   
            K = TEMP;   
        }       
        System.out.println ( "before the number of columns 20 and the sum:" + SUM);   
    } 
}

 

Guess you like

Origin www.cnblogs.com/ntdx-zhoulei/p/11294601.html