Ask coding questions

← Back to all posts
anyone can teach me some new coding trick
Creativekids (0)

i want to know some new coding trick

Comments
hotnewtop
codingjlu (215)

(node.js) Instead of:

const blah = require("blah");
const ha = require("ha");

you can simply do:

const blah = require("blah"),
ha = require("ha");
FloCal35 (668)

in HTML, instead of writing <div class"something"></div>, you can just type in .something and press enter
(IDK if that's a code trick but it's a lazy one)

ch1ck3n (2052)

instead of 2-line functions that do basically nothing, just write

def hello(name):
  print("Hello, "  + name + "!")

as

hello = lambda name : print("Hello, "  + name + "!")
Wumi4 (531)
  • Know Python decorators? Search about it if you don't know it.
  • Learn about data classes in Python if you don't, it can be pretty helpful

That's some new stuff that I know.