teleren/devto huggingface dataset:
Starting your first Laravel project
Tags: php, laravel
Published: 2021-02-21 08:01:29

Today I'll be showing you how easy it is to get started with a Laravel project.

Laravel is a PHP framework. For me, it focuses on good practices and clean code.

The super cool part about Laravel 8.0 is that it now comes with a simple terminal command to build an app that runs in Docker!

Before we start, make sure you have Docker desktop installed.

[Download Docker desktop](https://www.docker.com/products/docker-desktop)

## Installing Laravel

Once you have Docker installed and setup, we can open the terminal and execute the following command.

```bash
curl -s https://laravel.build/laravel-app | bash
```

Running this command will create a `laravel-app` folder in the current folder you in.

You can change the name to whatever you need it to be, so your projects need to be called `client-website` run the following command.

```bash
curl -s https://laravel.build/client-website | bash
```

With this command, it will setup all the packages and even set your application key for you.

To run the application, we can simply cd into the directory and run the following command.

```bash
cd laravel-app
./vendor/bin/sail up
```

The first time the sail up command will take quite a while but don't worry any time after that, it will be quick.

> Note: If you're on the new Mac M1, you need to change the `docker-compose.yml` file. Change `image: 'mysql:8.0'` to `image: mariadb:10.5.8`

Once everything is installed, you should see the following in your Docker desktop app.

![Screenshot 2021-02-16 at 08.21.49.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1613456611624/Tymbmo5zu.png)

And we should be able to view the application going to `http://localhost`.

> Note: you might have to change the port if you already have a server running on port 80

![Laravel app running via Docker](https://cdn.hashnode.com/res/hashnode/image/upload/v1613456664314/z3x8CzBe_.png)

And we even get a default Mailhog installation on port 8025:

![Screenshot 2021-02-16 at 08.21.34.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1613456708992/aZcp3woGi.png)

### Thank you for reading, and let's connect!

Thank you for reading my blog. Feel free to subscribe to my email newsletter and connect on [Facebook](https://www.facebook.com/DailyDevTipsBlog) or [Twitter](https://twitter.com/DailyDevTips1)
#온라인홀,#모바일홀덤 덤잼팟 ‘WPL 토너먼트’ 전개 박차 눈길
Published: 2021-02-21 07:50:52

1차 대회 성료•2차 대회 운영 중…”텍사스홀덤 온라인 대회 새로운 장 역할”

잼팟이 ‘원조이 포커리그(WPL) 토너먼트’를 대대적으로 전개하며 팬들의 관심을 끌고 있다. 국내에서 텍사스 홀덤에 대한 관심이 높아지고 있는 가운데 인기 확대와 인식 개선에 긍정적 영향을 미칠 것으로 기대된다. 

잼팟은 18일 ‘WPL’ 첫 번째 대회를 성황리에 마치고 두 번째 대회를 운영 중이라고 밝혔다. ‘WPL’은 텍사스 홀덤을 기반으로 한 게임이다. 대규모 토너먼트 콘텐츠와 복수의 경기를 동시에 플레이 할 수 있는 멀티 테이블 기능을 통해 전략적 두뇌 플레이의 재미를 제공한다.

또한 이 게임은 국제 토너먼트 룰(TDA)를 기반으로 하는 토너먼트 시스탬과 랜덤 딜링 시스템(RNG)를 인정받았다. 이를 통해 모든 유저가 공정하게 게임을 즐길 수 있는 환경을 제공한다.

작품 론칭 이후 첫 번째 대회가 12월 23일부터 1월 9일 사이 이뤄졌다. 당시 총 5000명의 이용자가 참여했다. 첫 대회 우승은 수산시장우럭티비(닉네임)가 차지했다. 이어 두 번째 대회 ‘WPL 윈터 시리즈’가 8일 개막해 21일까지 치러진다.

WPL 첫 대회 시상식. 프로 텍사스 홀덤 선수로 활약중인 임요환(오른쪽)
WPL 첫 대회 시상식. 프로 텍사스 홀덤 선수로 활약중인 임요환(오른쪽)
이 대회는 멀티데이 토너먼트 방식으로 치러진다. Day 1(8일~21일)에 열리는 토너먼트를 통과해 상위 라운드 진출 자격을 얻게 되고 같은 방식을 반복한다. 이를 통해 파이널 대결을 갖고 최종 우승자을 결정하는 것이다.

특히 하위 라운드에서 보유한 칩이 상위 라운드로도 이어져 더욱 대회가 이뤄질 것으로 보인다. 하위 라운드가 단순히 파이널 진출자를 걸러내는 역할을 하는 것이 아니라 향후 더욱 유리한 조건에서 플레이를 펼치기 위해 각 선수들이 진검승부를 벌인다는 것.https://cwurt001.com/

이와 함께 행사기간 중 스페셜 사이드 토너먼트 대회도 열려 박진감 넘치는 홀덤 승부를 관전할 수 있다. 이미 지난 12일부터 14일까지 3일간 200억 개런티 하이퍼터보, 400억 개런티 딥스택, 700억 개런티 빅게임 등 규칙이 추가되거나 바뀌는 방식의 대결이 이뤄졌다.

이번 주말에도 3차례에 걸쳐 스페셜 사이드 토너먼트가 치러진다. 19일 200억 개런티 프리즈아웃, 20일 300억 개런티 하이롤러, 21일 700억 개런티 파이널데이 빅게임 등이 열린다. 이 중 개런티 프리즈아웃은 리앤트리 및 라바이가 불가능한 규칙을 가졌다. 또 개런티 하이롤러는 바이인 금액이 높고, 파이널데이 빅게임은 개런티 큰 것이 특징이다.

이 같은 일정을 거쳐 21일에는 대회 파이널이 치러진다. 파이널 대회는 유튜브, 트위치 등의 채널을 통해 생중계될 예정이다. 대회 우승자에게는 실물 트로피와 ‘WPL 챔피언십 시리즈’ 참가자격이 주어진다. 스페셜 사이드 토너먼트 우승자에게는 실물 미니 트로피가 제공된다.

이 회사는 매월 ‘WPL 멀티 데이 토너먼트 시리즈’를 개최하고 연중 챔피언십을 열 계획이다. 이를 통해 WPL 대표 선수를 선발하는 한편 공식 프로선수 임요환, 김수조와 더불어 대규모 국제 대회 참가를 추진할 예정이다.

업계에서는 이 회사의 지속적인 토너먼트 시리즈를 통해 텍사스 홀덤에 대한 인기와 인식 개선을 동시에 이뤄나갈 것으로 보고 있다. 이미 오프라인 환경에서도 홀덤팝이 성행하는 등 텍사스 홀덤에 대해 사람들의 많은 관심이 이어지는 상황이다.

이 회사 역시 대회 멀티 데이 토너먼트 시리즈를 통해 명실상부한 한국 온라인 공식 대회로 자리매김하고 온라인 홀덤의 마인드 스포츠 및 e스포츠화에 이바지하는 것이 목표라고 밝혔다.

앞서 ‘WPL 론칭 시리즈’ 우승자 시상식에 참여했던 임요환 선수는 “코로나19로 국내외 홀덤 대회 대부분이 개최되지 못하고 안타까운 상황에서 ‘WPL 토너먼트’는 온라인에서 대규모 대회의 묘미를 즐길 수 있는 것은 물론 앞으로 홀덤 선수 및 이용자들에게 온라인 대회의 새로운 장 역할을 할 수 있을 것으로 기대된다”고 말했다.

 #온라인홀덤 #모바일홀덤
 #홀덤사이트 #온라인포커 #홀덤족보
Why separate username and password into two pages?
Published: 2021-02-21 07:44:25

Answer: Because the username/password isn't the only way to login.

If we want to support both [SSO](https://en.wikipedia.org/wiki/Single_sign-on) and username/password login, the first thing we need to do is to check which way the user has been using.

For example, if the user is using the Google SSO, then you check the email, make sure he/she is using the Google SSO, then show the Google SSO option.

[For someone who thinks the username/password is the best way to login](https://bradfrost.com/blog/post/dont-get-clever-with-login-forms/), it's not surprising that they feel cumbersome and "user-unfriendly" for splitting the username and password into two pages.

Still, if you want a single page to handle both SSO and username/password login, based on [this article](https://www.twilio.com/blog/why-username-and-password-on-two-different-pages), there are two options:
1. Show SSO options after the user types the email
2. Optional password field
CSS Battle #7 - Leafy Trail
Tags: html, cssbattle, webdev, tutorial
Published: 2021-02-21 07:35:58

So this challenge requires you to be comfortable with absolute positioning, building shapes with border-radius.
# Goal
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rf3pg87f0ujgdhli8205.png)
# Observation of Goal
A 3 rectangular shape with border-radius at 1 edge on top and bottom.
Nearly centered image (Meaning we can absolutely position and bring it to the center using the top and left)
Shapes overlap after some distance
It is prudent to guess the size of shapes say width and height rather than manually plugging in value. SO first we guess the size and the Code of the solution
# Solution
Combining the above observations we can figure out the code looks similar to the below code
```
<div> </div>
<div> </div>
<div> </div>
<style>
body {
	background: #0B2429;
}

div {
	left: 50%;
	top: 50% ;
	height: 150;
	width: 150;
	border-radius: 100px 0 100px 0;
	position: absolute;
  }

div:nth-child(1) {
	background: #1A4341;
	transform: translate(-125px, -75px);
}

div:nth-child(2) {
	transform: translate(-75px, -75px);
	background: #998235;
}

div:nth-child(3) {
	transform: translate(-25px, -75px);
	background: #F3AC3C;
  }
</style>
```
Do let us know how much time you took to achieve the target by yourself in the comments.
Fixing "Unexpected token \u0000 in JSON at position.." error
Published: 2021-02-21 07:35:53

I had this error while creating a react app but most of the solutions I found didn't solve the error and I thought I should write this for future reference.

You have to clean cache for the error to go away as it's corrupt. The following are ways of doing it inside a terminal.
For `npm`:
```js
npm cache verify
```
If it still doesn't work try:
```js
npm cache clean --force
```
For `yarn`:
```js
yarn cache clean
```
Elearning platform
Published: 2021-02-21 07:33:24

https://findcollabs.com/project/elearning-platform-UoJJdzbbtUSNXdfszZo5

My team, Signal Kinetics, is working on an open-source ELearning platform that is designed to be a one-size-fits-all solution. Companies will be able to upload content to a private intra/extranet for their clients/team to learn new skills, while teachers or instructors can create and distribute courses freely with minimal effort.

I originally came up with this idea as I'm doing freelance work for a consulting company that wants to have an onine portal for clients to browse content, and I thought that it would be great to create an open-source platform for anyone to create courses and learn new skills. I'm planning to build it using Flask and in the last week we've made a little bit of progress with it.

We're always looking for new teammembers and we'll take anyone!

Stay safe,
-L
Decision Making statements in C
Tags: cprogramming, programming, tutorial, beginners
Published: 2021-02-21 07:09:03

In this tutorial, we will study [decision making statements in c](https://usemynotes.com/what-is-decision-making-statements-in-c/), the if statement, else statement, and the if-else statement.

## What are the decision making statements?
Decision Making can be understood by using an example, the age of the student is stored in two-variables but if we want to print the age of the student we can use the decision-making statements (if, if-else, else if, Switch) in this situation.

## What are if statements?
The If statement uses the curly braces { } for defining the block. If the condition is true then the statement inside the block is executed. And if the condition is false then the compiler skips the statements inside the block. The if statement can be used as many times as we want to.

```
if(condition)
{
/* Statements */
}
```

## What are the if-else statements?

It is similar to the if statement but in this, the else block is added and the else is executed when the condition in the if is false. The If-Else Statement defines right and wrong. Just like the if statement it can be used as many times as we want to.

```
if(condition)
{
/* Statements1*/
}
else
{
/* Statements2*/
}
```

## What are the else statements?

If in the if and else we want to add a new condition then we have to define the else if block. Unlike the if and if-else statement, we can not use it else as many times as we want to. There can be only one else statement for each if statements.
```
if (condition)
{
/* Statements1*/
}
else if (condition)
{
/* Statements2*/
}
else (condition)
{
/* Statements3*/
}
```

## What is the switch statement?

The switch statement is similar to the if statement but in the switch statement we check the case. In the switch case, a variable is tested for equality against a list of values. On reaching a particular condition only the statements are executed which are written inside the case. The Case is matched with the integer variable. If the case integer variable is matched then the case is executed.
```
switch (expression)
{
case constant: statement1;
break;
case constant: statement2;
break;
case constant: statement3;
break;
default: statement;
break;
}
```
Fazendo o browser falar por você - Web Speech API
Tags: webdev, javascript, react, braziliandevs
Published: 2021-04-17 17:34:34

---
title: Fazendo o browser falar por você - Web Speech API
published: true
date: 2021-02-21 05:18:25 UTC
series: Dicas Rápidas
tags: 
  - webdev
  - javascript
  - reactjs
  - braziliandevs
canonical_url: https://willianjusten.com.br/fazendo-o-browser-falar-por-voce-web-speech-api/
---

## Introdução

Fala pessoal, eu recentemente comecei uma [série de vídeos com dicas bem rápidas](https://www.youtube.com/watch?v=1dNNL95BsJE&list=PLlAbYrWSYTiOviR_zL01FMa-kWEMDIjeO) lá no meu canal do YouTube, mas como eu também gosto de texto e também quero facilitar a busca seja pelo Google ou pelo YouTube, vou portar os vídeos para cá também. Espero que dê certo =)

## Vídeo

{% youtube SOgN69e9-Uc %}

## Apresentando o Japanese Words

Você pode ver meu projeto no ar, através [desse link](https://japanese-words.willianjusten.com.br/).

Atualmente eu estou estudando japonês e pensando nisso, eu resolvi fazer um projetinho para me ajudar no vocabulário e pronúncia. Tem um site chamado [mainichi](https://mainichi.me/) que tem uma extensão com várias palavras, então parti dali. Como pode notar, meu card é uma cópia descarada deles xD

Mas para o projeto ficar mais interessante e diferente, resolvi aplicar a Web Speech API para fazer o browser falar as palavras.

## Web Speech API

Você pode ver o projeto inteiro no [repositório oficial](https://github.com/willianjusten/japanese-words), mas vou me ater somente as partes que utilizei da Web Speech, que é bastante simples.

Os passos são:

- Primeiro pegamos as vozes disponíveis no device/browser usando o método [SpeechSynthesis.getVoices()](https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesis/getVoices)

```js
const voices = window.speechSynthesis?.getVoices()
```

- Depois nós filtramos essa lista para encontrar a voz que tenha a pronúncia da língua desejada, no nosso caso, o japonês.

```js
const jpVoice = voices?.find((voice) => /ja-JP/.test(voice.lang))
```

- Com as vozes, nós definimos o [Utterance](https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisUtterance), que seriam as configurações da leitura.

```js
const utterance = new SpeechSynthesisUtterance()

utterance.text = word // word é a palavra que desejamos pronunciar
utterance.lang = 'ja-JP' // língua a pronunciar
utterance.voice = voice // voz defina acima
utterance.rate = 0.8 // velocidade de fala
```

- Já com a voz determinada e as configurações de voz, agora é só usar o método para falar, que é o [speechSynthesis.speak](https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesis/speak)

```js
window.speechSynthesis.speak(utterance)
```

## Conclusão

E aí, gostou da dica? Se curtiu, não deixa de se inscrever lá no [canal do YouTube](https://www.youtube.com/WillianJustenCursos/) para essa e mais outras dicas.
Seventh-week web dev
Tags: beginners, webdev, programming, css
Published: 2021-02-21 06:32:19

Hi Everyone!! It has been 7 weeks since started doing web development. this week I have covered complete HTML and a lot of CSS parts.
for the next week, I am thinking to complete my to-do list project as well as try to improve the project. furthermore, I am interested in the tic tac toe game. I am thinking to learn tic tac toe through any tutorial on the internet and will try to add my style to the game. so that I can learn more. 


Thanks for reading!!
js swap two numbers
Tags: node, javascript
Published: 2021-02-21 06:09:25

Swap two numbers, a common problem-solving interview question.

1. Using a Variable

function swapTwoNumbers(a, b) {
    let temp = a;
    a = b;
    b = temp
    return [a, b];
}

console.log(swapTwoNumbers(10, 5))
// output a = 5, b = 10
*************************************
2. Using arithmetic operators

function swapTwoNumbers(a, b) {
    a = a + b; // 15
    b = a - b; // 15 - 5 = 10
    a = a - b; // 15 - 10 = 5
    return [a, b];
}

console.log(swapTwoNumbers(10, 5))

// output a = 5, b = 10
************************************
3. Using Destructuring

function swapTwoNumbers(a, b) {
    return [a, b] = [b, a]
}

console.log(swapTwoNumbers(10, 5))
Dark Mode using CSS variables
Tags: css, webdev, ux, darkmode
Published: 2021-02-21 05:53:03

# What is Dark Mode?

Dark mode, also called Light-on-dark color scheme, is a color scheme that uses light-colored text, icons, and graphical user interface elements on a dark background and is often discussed in terms of computer user interface design and web design.

The idea behind dark mode is that it reduces the light emitted by device screens while maintaining the minimum color contrast ratios required for readability.

# What are the advantages of Dark Mode?

- Can use less energy on the using device
- Can potentially reduce eye strain and dry eyes in low-light conditions
- Less `blue light` emitted from your phone – which can keep you awake if you use your device before heading to bed

# How to implement dark mode in your website?

Lets start with a html skeleton and a button and a linked stylesheet and script

```html
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Dark Mode</title>
    <link rel="stylesheet" href="style.css">
</head>
<body>
    <button class="btn" id="toggleBtn">
        Toggle Dark Mode
    </button>
    <script src="script.js"></script>
</body>
</html>
```

Now let's address the main issue. First we will be adding the css variables for the colors (lets call them `primary` and `background`) and override the required color(s) in the dark mode

```css
:root{
    --primary: #4240b4;
    --background: #dddddd;
}

.dark{
    --background: #222222;
}

html,
body{
    background-color: var(--background);
}

.btn{
    background-color: var(--primary);
}
```

So from the javascript, we only need to toggle the class list of the body of the html document

```javascript
const body = document.querySelector("body")
const toggleBtn = document.querySelector("#toggleBtn")

toggleBtn.addEventListener("click", (e) => {
    body.classList.toggle("dark")
})
```

# Demo

{% codepen https://codepen.io/ruppysuppy/pen/eYBEogP %}

# Project using this Implementation

**Smartsapp**

Web-app: [https://smartsapp-ba40f.firebaseapp.com](https://smartsapp-ba40f.firebaseapp.com/)

{% github https://github.com/ruppysuppy/SmartsApp %}

Finding **personal finance** too intimidating? Checkout my **Instagram** to become a [**Dollar Ninja**](https://www.instagram.com/the.dollar.ninja/)

# Thanks for reading

Reach out to me on:

-   [Portfolio](https://tapajyoti-bose.web.app)
-   [GitHub](https://github.com/ruppysuppy)
-   [LinkedIn](https://www.linkedin.com/in/tapajyoti-bose-429a601a0)
How to build a Madlib Game in Python
Tags: python, codenewbie, beginners, tutorial
Published: 2021-02-21 05:35:37

Hey folks, let's build a Madlibs Game in Python!

## How does it work?

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r6iye3nnn8xnr1teb0y2.png)

A Madlib game is a super simple game where we put random nouns and adjectives into a sentence.

In our game, the player will be asked to enter two different nouns & one adjective of their choice.

Both nous & adjectives will be stored in a separate variable and then they will be concatenated in a string.

And the final string will be printed on the screen.

Sounds fun right? Let's build it!

## Let's Code

Alright, so the first thing we are gonna do is to ask the user to enter 2 nouns and an adjective. We will use **`input()`** function as always.

```python
noun = input("Noun: ")
adj = input("Adjective: ")
noun2 = input("Noun: ")
```

Awesome now we will simply put them into our sentence.

You can use any appropriate sentence of your choice. You can also Google for fun Madlib sentences. Please note that other sentences may require you to add or remove nouns and adjectives... But that shouldn't be a problem since this tutorial is super easy to follow.

For this tutorial, we are going to make use of this silly sentence - 

> After hiding the painting in his **`noun`** for two years, he grew **`adj`** and tried to sell it to a **`noun2`** in Mumbai, but was caught...

Now, all we have to do is to, replace the missing spots with our variables. Let's do that using **`f-strings`.**

```python
print(f"After hiding the painting in his {noun} for two years, he grew {adj} and tried to sell it to a {noun2} in Mumbai, but was caught...")
```

There we go!

We did it! Easy and short right! 

Feel free to customize it and make it more fun to play with your friends.

## Source Code

You can find the complete source code of this project here -

[mindninjaX/Python-Projects-for-Beginners](https://github.com/mindninjaX/Python-Projects-for-Beginners/tree/master/Madlibs)

## Support

Thank you so much for reading! I hope you found this beginner project useful. 

If you like my work please consider [Buying me a Coffee](https://buymeacoff.ee/mindninjaX) so that I can bring more projects, more articles for you.

![https://dev-to-uploads.s3.amazonaws.com/i/5irx7eny4412etlwnc64.png](https://dev-to-uploads.s3.amazonaws.com/i/5irx7eny4412etlwnc64.png)

Also if you have any questions or doubts feel free to contact me on [Twitter](https://twitter.com/mindninjaX), [LinkedIn](https://www.linkedin.com/in/mindninjax/) & [GitHub](https://github.com/mindninjaX). Or you can also post a comment/discussion & I will try my best to help you :D
🎉 Product Launch - "Note Box" Chrome Extension 🎉
Tags: productivity, sideprojects, showdev, chromeextension
Published: 2021-02-21 05:35:35

Hey Everyone, 

I just released my second chrome extension **"NOTE BOX"**. It lets you write notes based on the *URL* (specifically domain). Notes appear when you go back to the same domain (or any of its URLs) or can be accessed from Homepage.

Demo - [https://www.youtube.com/watch?v=fX3IKhiEz1s](https://www.youtube.com/watch?v=fX3IKhiEz1s)

Download it here - [https://chrome.google.com/webstore/detail/note-box/mbbajjgefpenmkkhcnmmnoodlbcbfnmp](https://chrome.google.com/webstore/detail/note-box/mbbajjgefpenmkkhcnmmnoodlbcbfnmp)

#### Screenshots

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0f3471fa7kwkmd8qzmfb.png)

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rr0vs1ktg9qgzfll31uf.jpg)

--- 

My first chrome extension **"GITHUB MARKER"** provides options like `Bookmark/Read/Favorite` a link on Github repos.

Download it here - [https://chrome.google.com/webstore/detail/github-marker/imjdbnnpnohgcdbpgnidgolnamoghpoo](https://chrome.google.com/webstore/detail/github-marker/imjdbnnpnohgcdbpgnidgolnamoghpoo)

#### Screenshots

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7iju2zk91zyes29v8zzv.jpg)

**DM if anyone interested in collaborating/contributing.**

Would appreciate like, share or comment.

**Note**: **No signup. Free of cost. All the data is stored in browser memory.**

Hope you like it.

Thanks.

---

**Thanks for reading 💙**  
Follow **@codedrops.tech** for daily posts.  
[Instagram](https://www.instagram.com/codedrops.tech/) ● [Twitter](https://twitter.com/codedrops_tech) ● [Facebook](https://www.facebook.com/codedrops.tech/)

Micro-Learning ● Web Development ● Javascript ● MERN stack ● Javascript  
**[codedrops.tech](https://www.codedrops.tech/)**
Juntando arrays e objetos com Spread syntax no JavaScript
Tags: javascript, braziliandevs, tips
Published: 2021-05-03 15:57:08

---
title: Juntando arrays e objetos com Spread syntax no JavaScript
published: true
date: 2021-02-21 04:12:03 UTC
series: Dicas Rápidas
tags: 
  - javascript
  - braziliandevs
  - tips
canonical_url: https://willianjusten.com.br/justando-arrays-e-objetos-com-spread-syntax-no-javascript/
---

## Introdução

Fala pessoal, eu recentemente comecei uma [série de vídeos com dicas bem rápidas](https://www.youtube.com/watch?v=1dNNL95BsJE&list=PLlAbYrWSYTiOviR_zL01FMa-kWEMDIjeO) lá no meu canal do YouTube, mas como eu também gosto de texto e também quero facilitar a busca seja pelo Google ou pelo YouTube, vou portar os vídeos para cá também. Espero que dê certo =)

## Vídeo

{% youtube 1Y8h-R-uymM %}

## Utilizando o poder do ...Spread

Antigamente para fazer esse tipo de formatação nós precisávamos fazer algum método próprio ou cair em soluções como o [Lodash](https://lodash.com/docs/4.17.15#merge). Mas agora graças ao [Spread Operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax) nós conseguimos fazer isso de forma simples, somente utilizando o JS puro.

Vamos ver abaixo alguns exemplos na prática:

```js
const arrayOne = [1, 2, 3, 4]
const arrayTwo = [5, 6, 7, 8]

// juntando os arrays
const newArray = [...arrayOne, ...arrayTwo] // [1, 2, 3, 4, 5, 6, 7, 8]

// funciona com objetos também!
const props = { id: '1', name: 'Willian' }
const moreProps = { age: 30, height: 178 }

const newObj = { ...props, ...moreProps } // { id: '1', name: 'Willian', age: 30, height: 178 }

// E você também consegue sobrepôr valores
const defaultProps = { id: '1', name: 'Willian' }
const newProps = { id: '3', age: 30 }

// Chaves iguais são sobreescritas pelo último objeto passado
const propsObj = { ...defaultProps, ...newProps } // { id: '3', name: 'Willian', age: 30 }
```

## Conclusão

E aí, gostou da dica? Se curtiu, não deixa de se inscrever lá no [canal do YouTube](https://www.youtube.com/WillianJustenCursos/) para essa e mais outras dicas.