Java Script/MDN 정리
자바스크립트 구성요소 ~ 함수는 값을 반환한다
Zin0_0
2020. 7. 26. 19:06
반응형
반환 값이란
let myText = 'The weather is cold'
let newString = myText.replace('cold', 'warm')
console.log(newString) // Should print "The weather is warm"
// the replace() string function takes a string,
// replaces one substring with another, and returns
// a new string with the replacement made
- replace() 메소드의 작동 원리
- 'cold' substring을 찾는다.
- 해당 substring을 'warm'으로 대체한다.
- 위에서 작업이 완료된 새로운 string을 반환한다.
- void 형태를 제외하고는 return 값을 가진다.
- undefined를 반환하는 경우도 반환 값이 있는 경우
Active learning: our own return value function
function-library.html 카피하기
필드와