JSFiddle - React, Tailwind, and code Playground

by rexonms

JavaScript

// Chapter 2 

// Spread Operators as arguments
// When spread operators are passed as the argument. All the extra arguments are dumbed in the last arguments as array
function foo(x,y,z, ...args) {
	console.log(x,y,z,args)
 }
 
 foo()											// undefined undefined undefined Array(0)
 foo(1,2,3)									// 1 2 3 Array(0)
 foo(1,2,3,4)								// 1 2 3 Array(1)
 foo(1,2,3,4,5)							// 1 2 3 Array(2)
 
 // Parse Int
 console.log(parseInt(0101, 2))				// NaN
 console.log(parseInt(0101, 10)) 			// 65 *The zero shouldn't in the front
 console.log(parseInt("0101", 10))		// 101
 console.log(parseInt(0101, 2))				// NaN
 console.log(parseInt(2000.11, 10)) 	// 2000