Korisne prečice za JavaScript i TypeScript

https://blog.logrocket.com/16-useful-typescript-ja... link-img
avatar

JavaScript and TypeScript share a number of useful shorthand alternatives for common code concepts. Shorthand code alternatives can help reduce lines of code, which is something we typically strive for.

In this article, we will review 16 common TypeScript and JavaScript shorthands. We will also explore examples of how to use these shorthands.

Read through these useful JavaScript and TypeScript shorthands or navigate to the one you’re looking for in the list below:

  • Ternary operator
  • Short-circuit evaluation
  • Nullish coalescing operator
  • Template literals
  • Object property assignment shorthand
  • Optional chaining
  • Object destructuring
  • Spread operator
  • Object loop shorthand
  • Array.indexOf shorthand using the bitwise operator
  • Casting values to boolean with !!
  • Arrow/lambda function expression
  • Implicit return using arrow function expressions
  • Double bitwise NOT operator
  • Exponent power shorthand
  • TypeScript constructor shorthand
2

ULOGUJ SE I DODAJ KOMENTAR


Registruj ili prijavi.

VIDI POPULARNE POSTOVE


1
avatar Vukašin pre 6 sati
1
avatar Stefan juče
2
3
avatar Anastasia pre 21 dana
2
avatar Aljosa pre 2 dana
2
avatar Bojan pre 5 dana
1
avatar Stefan pre 6 dana
1
avatar Stefan pre 7 dana
1
avatar Vukašin pre 8 dana
1
avatar Stefan pre 9 dana
1
avatar Vukašin pre 12 dana