Ir para conteúdo principal
Lucas Caton


O caminho certo para aprender React

70 videoaulas. Mais de 11 horas de conteúdo. Vários projetos desenvolvidos!

Quero saber mais

Vídeo: Introdução à JavaScript (JS) em 30 minutos

Variáveis, tipos, manipulação de DOM, requisições assíncronas (AJAX) e mais

Lucas Caton

Lucas Caton

Aprenda o básico de JavaScript (JS) através do mais recente vídeo que publiquei no meu canal do YouTube:

Abaixo você encontra os arquivos criados/utilizados no vídeo:


<!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Introdução à JS</title>

    <link rel="stylesheet" href="css/style.css">

        [Alterar tema](#" id="theme-toggle)

        <h1>The Matrix</h1>


        <ul class='cast'></ul>

          The Matrix is a 1999 science fiction action film[3][4] written and directed by the Wachowskis.[a] It stars Keanu Reeves, Laurence Fishburne, Carrie-Anne Moss, Hugo Weaving, and Joe Pantoliano and is the first installment in the Matrix franchise. It depicts a dystopian future in which humanity is unknowingly trapped inside a simulated reality, the Matrix, created by intelligent machines to distract humans while using their bodies as an energy source.[5] When computer programmer Thomas Anderson, under the hacker alias "Neo", uncovers the truth, he "is drawn into a rebellion against the machines"[5] along with other people who have been freed from the Matrix.

          The Matrix is an example of the cyberpunk subgenre of science fiction.[6] The Wachowskis' approach to action scenes was influenced by Japanese animation[7] and martial arts films, and the film's use of fight choreographers and wire fu techniques from Hong Kong action cinema influenced subsequent Hollywood action film productions. The film is known for popularizing a visual effect known as "bullet time", where the heightened perception of certain characters is represented by allowing the action within a shot to progress in slow-motion while the camera appears to move through the scene at normal speed, allowing the sped-up movements of certain characters to be perceived normally. While some critics have praised the film for its handling of difficult subjects, others have said the deeper themes are largely overshadowed by its action scenes.

    <script src="js/app.js"></script>


* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;

body {
  background-color: #f5f5f5;

main {
  max-width: 500px;
  min-height: 100vh;
  margin: auto;
  padding: 1rem 2rem;
  font-family: sans-serif;
  background-color: white;
  color: #333;

article h1 {
  margin: 1rem 0;
  font-size: 3rem;

article p {
  font-size: 1.4rem;
  margin: 2rem 0;

nav {
  display: flex;
  flex-direction: row-reverse;

#theme-toggle {
  text-decoration: none;
  padding: 0.25rem 0.5rem;
  border-radius: 5px;

  background-color: #eee;
  color: #333;

ul {
  margin: 1rem 0 0 3rem;

/* Dark theme */

body.dark {
  background-color: #222;

body.dark main {
  background-color: #444;
  color: #eee;

body.dark #theme-toggle {
  background-color: #777;
  color: #ddd;


document.querySelector('#theme-toggle').addEventListener('click', (event) => {


function toggleTheme() {
const cast = [
  'Keanu Reeves',
  'Carrie-Anne Moss',
  'Laurence Fishburne',
  'Hugo Weaving'

const castList = document.querySelector('.cast');

cast.forEach(person => {
  const item = document.createElement("li");
  const personName = document.createTextNode(person);

  // P.S. Existem formas melhores de fazer ↑ isso,
  // usando um framework tipo React por exemplo :)
document.querySelector('main').innerHTML = '';

  .then(response => response.json())
  .then(repos => repos.forEach(repo => {
    let item = document.createElement("li");
    var repoName = document.createTextNode(;
Se curtiu o vídeo, não deixe de se inscrever no canal! 😉