본문 바로가기

js3

[leetcode/JS] 28. Implement strStr() /Javascript 문제 링크 https://leetcode.com/problems/implement-strstr/ Implement strStr() - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 투포인터를 사용 해 풀었습니다 기억하면 좋을 것 / 소감 indexOf()를 쓰는게 속도 빠르니까 그렇게 하자 indexOf() 짚고 넘어가기 indexOf() 메서드는 배열에서 지정된 요소를 찾을 수 있는 첫 번째 인덱스를 반환하고 존재하지 않으면 -1을 반환합니다. https://.. 2022. 5. 12.
[ JavaScript ] 함수 선언식Function Declaration) VS 함수 표현식 (Function Expression) 안녕하세요 질서정연입니다 🧶 이번시간에는 JS에서 함수 선언식과 함수 표현식의 차이에 대해 알아보겠습니다. 함수 선언식 Function Declaration 함수 선언 (function declaration) 은 지정된 매개변수 (parameter)를 갖는 함수를 정의 합니다. 함수 선언으로 생성된 함수는 Function 객체로 Function 객체의 모든 속성 , 메소드 및 행위 특성을 갖습니다. 기본적으로 함수는 undefined 를 반환하며 다른 값을 반환하기 위해서 함수는 반환값을 지정하는 return 문이 있어야 합니다. JS를 공부 하다가 hoisting 에 관해서 들어보셨나요? Hoisting은 JS의 기본 동작이며 선언을 현재 scope의 최상단으로 올려 줍니다. JS에서 선언은 hoist.. 2022. 4. 15.
[leetcode] 20. Valid Parentheses / JS Javascript 코드 , 풀이 문제 제목 Valid Parentheses 문제 링크 https://leetcode.com/problems/valid-parentheses/ Valid Parentheses - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 코드 /** * @param {string} s * @return {boolean} */ var isValid = function(s) { let A = [s[s.length-1]]; for (let i =s.length-2; i>=0; i-.. 2022. 4. 6.