Node.js

JavaScript - 함수의 기본 문법

수업소개

코드를 정리 정돈해서 재활용성을 높여주는 도구인 함수의 기본 문법을 알아봅니다. 

 

 

 

강의

 

 

 

소스코드

syntax/function2.js


f123();
console.log('A');
console.log('Z');
console.log('B');
f123();
console.log('F');
console.log('C');
console.log('P');
console.log('J');
f123();
console.log('U');
console.log('A');
console.log('Z');
console.log('J');
console.log('I');
f123();

function f123(){
  console.log(1);
  console.log(2);
  console.log(3);
  console.log(4);
}

 

댓글

댓글 본문
  1. Nayeong Koo
    23.03.17
  2. 감자
    22.12.02 완료
  3. 당당
    2022.10.21
  4. 키다리아저씨
    220718 완
  5. 코지마 히데오 뺨 후릴 반바지
    와안료
  6. 소설가
    2021-1-5 완료
    고맙습니다.
  7. kimkk
    JavaScript Hoisting refers to the process whereby the interpreter appears to move the declaration of functions, variables or classes to the top of their scope, prior to execution of the code.

    Hoisting allows functions to be safely used in code before they are declared.

    Variable and class declarations are also hoisted, so they too can be referenced before they are declared. Note that doing so can lead to unexpected errors, and is not generally recommended.
  8. sofom
    f123() 함수가 18번째 줄 부터 정의되는데 어떻게 첫 번째 줄 부터 f123()을 사용할 수 있는 건가요? 확실하진 않지만 예전에 파이썬 쓸 때는 저런 경우에 함수가 정의되지 않았다고 떴던 것 같아서요.
  9. 김건희
    2021.12.27

    현재까지의 소감: 아직 어렵지만 재밌다.
  10. 초딩 개발자
    2021/12/02
  11. 김관호
    21.11.23
  12. pdpd
    21.10.07
  13. 졸작완성하자
    210907 완료
  14. 승뇽뇽
    ㅇㄹ
  15. 박사장
    21 07 29 완료!
  16. Duke
    2021.07.18
  17. Jeong Il Haan
    20210419
  18. byoonn
    완료
  19. chimhyangmoo
    21.02.19
  20. jeisyoon
    2021.02.08 완료
  21. 임찬혁
    완료
  22. Noah
    2021.01.04 완료!
  23. kkn1125
    20.12.21 완료~!
  24. Yong Hyun Lee
    완료 201002
  25. CH Yim
    완료
  26. vampa
    2020.09.09
  27. 최현규
    해당 코드의 파일 이름은 function.js 입니다.다음 페이지 소스코드가 function2.js 입니다.
  28. 마준
    완료
  29. 코딩조아
    20.08.13
  30. 누누
    2020.07.31 완료
  31. 코딩하는렌즈쟁이
    2020-07-27 (월)
    완료
  32. Jenny Song
    25th.JULY.2020 완료
  33. hoya
    2020.07.11
  34. Amousk
    좋은 강의 감사합니다.
  35. 사아
    폭발적 효과와 유지보수의 편의성!!!
  36. 김재익
    함수는 대다네~ 완료
  37. 바다의왕자
    완료
  38. Eunsung Shin
    완료
  39. 준바이
    감사합니다
  40. 심여수
    감사합니다.
  41. eddylee123456
    복습
  42. 스티븐잡숴
    완료
  43. 임은정
    완료
  44. JT_brand
    완료
  45. codinginpain
    완료
  46. 박창신
    수강완료
  47. 행인
    var는 변수를 선언하는 키워드고, function은 함수를 선언하는 키워드입니다.

    다만, 자바스크립트에서는 변수에 함수를 넣을 수도 있기 때문에,

    var a = function b() { ... };

    이런 표현도 가능합니다.
    대화보기
    • 쑤우
      수강완료. 감사합니다~
    • 굼벵이
      완료
    • CronEB
      완료 훌륭합니다 함수님은 언제나 옳죠
    버전 관리
    egoing
    현재 버전
    선택 버전
    graphittie 자세히 보기