D4: Tips (for loops / conditions), Keyboard Shortcuts

devfish·2022년 12월 21일
0

Javascript

목록 보기
1/30

TIPS

  • to get out of the two for-loops, return is better than break
  • template literal → can assign to variable string!
  • same name functions: last function is the final function!

Keyboard shortcuts!

  • Links (stackblitz shortcuts, unicode symbols, mac shortcuts)
  • ⌘ + ⌃ + Space : emojis for notion!
  • ⌥ + ↑↓ - 전체 줄 이동!
  • ⌥ + 여러 줄 한꺼번에 선택, 편집 가능
  • ⌘ + ↑↓: 브라켓 별로 이동 가능!
  • ⌘ + D / ⌘ + ⇧ + L - 다중선택 - 변수 이름 다 바꾸기
  • ⌘ + ←→ : move to front / end of line
  • ⌥ + ←→ : move cursor whole words at a time
  • ⇧ + ←→ : highlight characters of code
  • ⌥ + ⇧ + ←→: highlight word by word
  • ⌘ + ⇧ + ←→ : highlight all the left or right, up or down from cursor location

Move Cursor Whole Words At A Time

Moving your cursor through code is incredibly important since you commonly need to change code in different parts of the same file. Doing this with the mouse is slow and cumbersome so instead use the shortcut of ctrl + left arrow and ctrl + right arrow to move your cursor to the left or right by an entire word at a time. This is great for quickly moving across a line of code or getting to the end of a long word. This shortcut becomes even more useful when combined with the next shortcut.

Highlight Characters Of Code

If you want to highlight a section of code next to your cursor you can use shift + left arrow and shift + right arrow to move your cursor one character at a time to the left or right and also highlight the character you move over at the same time. This is great for selecting small typos in your code to fix or to select small sections of code to copy and paste. You can even combine this with the previous shortcut by pressing ctrl + shift + left/right arrow to highlight entire words at a time instead of just one character.

Eloquent JS:

  • global / local scope
  • lexical (nested) scope
  • function expressions:
    • interesting things that can be done by passing around function values to other functions.
  • Function declarations are not part of the regular top-to-bottom flow of control. They are conceptually moved to the top of their scope and can be used by all the code in that scope. This is sometimes useful because it offers the freedom to order code in a way that seems meaningful, without worrying about having to define all functions before they are used.
  • Arrow functions were added in 2015, mostly to make it possible to write small function expressions in a less verbose way
profile
la, di, lah

0개의 댓글