Navigating financials for tech startups

I finished listening to an Andreesen Horowitz podcast of the important financials and metrics to pay attention to, and thought I’d share a summary. The focus is primarily on what to look at in the 3…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Benefits of spread operator

We can use spread operator in array and object. The syntax is 3 dots(…).

Create new array from existing array
let origArrayOne = [ 1, 2, 3]; //1,2,3
let origArrayTwo = [ 4, 5, 6]; //4,5,6

Create new array from existing array
let copyArray = […origArrayOne]; //1,2,3

Create new array from existing array + more elements
let newArray = […origArrayOne, 7, 8]; //1,2,3,7,8

Create array by merging two arrays
let mergedArray = […origArrayOne, …origArrayTwo]; //1,2,3,4,5,6

Create new object from existing object
let origObjectOne = {a: 1, b: 2, c: 3}; //{a: 1, b: 2, c: 3}
let origObjectTwo = {d: 4, e: 5, f: 6}; //{d: 4, e: 5, f: 6}

Create new object from existing object
let copyObject = {…origObjectOne}; //{a: 1, b: 2, c: 3}

Create new object from existing object + more elements
let newObject = {…origObjectOne, g: 7, h: 8}; //{a: 1, b: 2, c: 3, g: 7, h: 8}

Create object by merging two objects
let mergedObject = {…origObjectOne, …origObjectTwo}; //{a: 1, b: 2, c: 3, d: 4, e: 5, f: 6}

sampleFunction(a, b, c) {
console.log( a );
console.log( b );
console.log( c );
}

let parametersArray = [0, 1, 2];

sampleFunction(…parametersArray); //0, 1, 2

Add a comment

Related posts:

Why do some dogs have shiny and beautiful fur

A dog shedding is normal, but it is found that the dog does not change normally, but a large amount of hair loss. Take a look at others Dogs and dogs are very smooth and shiny, then look at your dog…

Hello There Little Baby Cousin

Even though you were born at a time of great uncertainty in the world, you are one of the luckiest babies EVER BORN. Your mommy carried you with so much strength, courage, joy… and apparent ease even…

8 Tips for Safe Web Browsing and Accessing the Internet

Hackers make an attempt at breaking into a system every 39 seconds. The last thing that you would want is for them to make your system the one that they break into. Safe web browsing is essential if…