js3 Uncaught SyntaxError: Cannot use import statement outside a module index.html> type="module" 로 명시해줘야 함. 2021. 2. 2. [프로그래머스] 평균 구하기, reduce() 메소드 문제설명> 정수를 담고 있는 배열 arr의 평균값을 return하는 함수, solution을 완성해보세요. 제한사항 arr은 길이 1 이상, 100 이하인 배열입니다. arr의 원소는 -10,000 이상 10,000 이하인 정수입니다. 코드> function solution(arr) { var answer = 0; for(var i=0;i function average(array) { return array.reduce((a,b) => a+b) / array.length; } reduce() 메소드는 배열의 각 요소에 대해 주어진 reducer 함수를 실행하고, 하나의 결과값을 반환한다. https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Gl.. 2020. 7. 28. Mozilla - javascript first steps In this module What is JavaScript? A first splash into JavaScript What went wrong? Troubleshooting JavaScript Storing the information you need — Variables Basic math in JavaScript — numbers and operators Handling text — strings in JavaScript Useful string methods Arrays Assessment: Silly story generator Silly story generator In this assessment you'll be tasked with taking some of the knowledge y.. 2019. 11. 5. 이전 1 다음