본문 바로가기

자바스크립트5

Try-catch is not working for 400 errors in JS try -catch 에서 error 가 나는데도 계속 try 로 들어갔다... async await 을 확인하지 못한 나 ... axios.post에 await 붙여주니까 바로 됐다. https://stackoverflow.com/questions/59582828/try-catch-is-not-working-for-400-errors-in-js Try-catch is not working for 400 errors in JS This is getting on my nerves, I've been checking the code for a few hours and can't spot the problem. in the below code, I'm using an invalid object in the bo.. 2023. 7. 26.
[leetcode/JS] 234. Palindrome Linked List / Javascript 문제링크 https://leetcode.com/problems/palindrome-linked-list/ Palindrome Linked List - 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 기억하면 좋을 것 배열의 순서를 정반대로 뒤바꾸고 싶을때 어떻게 할까 ? 바로 reverse 배열 내장 함수를 사용하면 된다. 그런데 문자열을 정반대로 바꾸어 주고 싶다면 ? split() reverse() join() 세가지를 기억하자 split('') 은 문자열을 .. 2022. 8. 25.
[leetcode/JS] 70. Climbing Stairs / Javascript 문제링크 https://leetcode.com/problems/climbing-stairs/ Climbing Stairs - 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 기억하면 좋을 것 이 문제는 recursive로 풀면 시간 초과로 통과하지 못한다. memoization 을 이용해 빈 배열을 생성하고 , 거기에 결과값을 저장 해 나가며 최종 결과를 반환해야한다. DP는 하향식(Top-Down 방식), 상향식(Bottom-UP 방식) 두 가지 방식으로 풀 수.. 2022. 8. 23.
[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.