FrontEnd(15)
-
[leet code - easy] Valid Parentheses ๋ฌธ์ ํ์ด
Description Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. s๋ (),{},[]๋ง ๋ค์ด๊ฐ ์ ์๋๋ด An input string is valid if: Open brackets must be closed by the same type of brackets. Open brackets must be closed in the correct order. Every close bracket has a corresponding open bracket of the same type. ์ด๋ฆผ ๊ธฐํธ๋ ๋ซํ ๊ธฐํธ ๋ ๋ค ์์ด์ผ ํ๋๋ด ๊ทผ๋ฐ ์ ํํ๊ฒ..
2023.08.23 -
[leet code - easy] Palindrome Number ๋ฌธ์ ํ์ด
Description Given an integer x, return true if x is a palindrome, and false otherwise. ๋ฆฌ๋ฒ์ค ๋ ๊ฒ x๋ ๊ฐ์ผ๋ฉด true ๋ผ๋ ๊ฒ ๊ฐ์ ์ ์ถ๋ ฅ ์์ Example 1: Input: x = 121 Output: true Explanation: 121 reads as 121 from left to right and from right to left. Example 2: Input: x = -121 Output: false Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is not a palindrome. Exam..
2023.08.22 -
[leet code - easy] two sum ๋ฌธ์ ํ์ด
์ํ์ ๋จธ๋ฆฌ๊ฐ ์์ ์๋ ๋ฏ ํ์ฌ ์๋ฆฌ๋ ผ๋ฆฌ๋ ฅ์ ์ข ํค์๋ณด๊ณ ์ ์๊ณ ๋ฆฌ์ฆ ๋ฌธ์ ๋ฅผ ํ๊ธฐ๋ก ํจ ํ๋ก๊ทธ๋๋จธ์ค๋ ์ข์ง๋ง ์์ด๊ณต๋ถ๋ ๊ฐ์ด ํ๋ ค๊ณ ์น๊ตฌํํ ์ถ์ฒ๋ฐ์ leet code ๋์ฅ๊นจ๊ธฐ๋ฅผ ํ ๊ฒ์ medium๊น์ง ๋ค ํ ์ ์์ผ๋ฉด ํด์ธ ์ทจ์ ๋ ์ฝ๊ฐ๋ฅ์ด๋ผ๊ณ ํ๊ธธ๋ medium๊น์ง ๋ค ํ์ด๋ณด๋๊ฒ ๋ชฉํ์ ๊ทผ๋ฐ ํ๋ฌธ์ ํธ๋๋ฐ 5์๊ฐ ๊ฑธ๋ฆฌ๋๊ฑฐ ๋ง๋.... Description Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. You may assume that each input would have exactly one solution, and you ma..
2023.08.21 -
key enter event๊ฐ ์๋จนํ
form tag์์ input์ด ํ๋๋ง ์์ ๋ enter ์ด๋ฒคํธ๊ฐ ์๋จนํ๋ ๋ฌธ์ ๊ฐ ์์ form tag์ onsubmit="return false;"๋ฅผ ์ ์ฉํด์ฃผ๋ฉด ๋
2023.08.08 -
[vue,javascript]input image file ์ฌ๋ฆด ์ preview ๋์ฐ๊ธฐ
๊ฒ์ํ์ ๊ธ ๋ฑ๋ก์ image ํ์ผ์ ์ฌ๋ฆฌ๋ฉด preview๊ฐ ์ฆ์ ๋์์ง๋๋ก ๊ตฌํํด์ผํจ data() { return { notice: {} } }, methods: { readImg(file) { const files = $(`#${file}`)[0].files[0]; const reader = new FileReader(); reader.readAsDataURL(files); reader.onload = (event) => { if (file == 'banner_img') { this.notice.Banner = event.target.result; } else if (file == 'thumbnail_img') { this.notice.ThumbnailPath = event.target.result;..
2023.08.08 -
Failed to execute 'readAsDataURL' on 'FileReader': parameter 1 is not of type 'Blob’
input์ ํตํด ์ด๋ฏธ์ง ์ ๋ก๋์, ์ด๋ฏธ์ง ์ ํ ํ ์ทจ์ ๋ฒํผ์ ๋๋ ๋๋ ์ด๋ฐ ์๋ฌ๊ฐ ๋ฌ๋ค. FileReader,readAsDataURL()๋ก ์ด๋ฏธ์ง ์ค์๊ฐ ๋ฐ์ํด์ฃผ๊ณ ๋์ ์๊ธด ์ด์์๋ค e.target.file์ผ๋ก ํ์ธํด๋ณด๋ ์ด๋ฏธ์ง ์ ํ ์ file์ length๊ฐ 1 ์ทจ์ ์ 0์ผ๋ก ๋์ค๋ ๊ฒ์ ํ์ธํ์ฌ file์ length๊ฐ 0์ผ๋๋ return, 0์ด ์๋ ๋๋ file์ ๋ถ๋ฌ์ค๋ ๊ฒ์ผ๋ก ์กฐ๊ฑด์ ๊ฑธ์ด์ฃผ์์! const handleImage() => { const file = e.target.files; if (file.length === 0) { // file์ด ์ ํ๋์ง ์์์ ๋. return; } else { // file ์ด ์ ํ ๋์์ ๋ ...img ๋ถ๋ฌ์ค๋ ์ } };
2023.08.08