목록til (11)
kimmgamjja
after() , insertAfter() A.after(B) : A 뒤에 B 삽입 A.insertAfter(B) : A를 B 뒤에 삽입 $("#a").after($("#b")); // $("#a") 뒤에 $("#b") 삽입// $("#a")// $("#b")$("#a").insertAfter($("#b")); // $("#a") 를 $("#b") 뒤에 삽입// $("#b")// $("#a")before(), insertBefore()A.before(B) : A 앞에 B 삽입A.insertBefore(B) : A를 B 앞에 삽입$("#a").before($("#b")); // $("#a") 앞에 $("#b") 삽입// $("#b")// $("#a")$("#a").insertBefore($(..
1. 함수로 구현자리수만큼 남은 앞부분을 0으로 채움function fillZero(width, str){ return str.length >= width ? str:new Array(width-str.length+1).join('0')+str; //남는 길이만큼 0으로 채움}2. 문자열(String) 또는 숫자 (Number) 프로토타입 메서드로 구현- 숫자 프로토타입으로 입력 길이만큼 앞에 0을 채운 문자열 반환 Number.prototype.fillZero = function(width){ let n = String(this);//문자열 변환 return n.length >= width ? n:new Array(width-n.length+1).join('0')+n; //남는 길이만큼 0으로 채움..
toFixed()numObj.toFixed([소수 부분의 자릿수]) : Number 인스턴스의 소수 부분 자릿수를 전달받은 값으로 고정한 후, 그 값을 문자열로 반환 let numObj = 1.23456 console.log(numObj.toFixed()); // 결과: '1'console.log(numObj.toFixed(6)); // 결과: '1.234560'console.log(numObj.toFixed(3)); // 결과: '1.235'console.log(numObj.toFixed(1)); // 결과: '1.2'numObj = 0.0005678 console.log(numObj.toFixed()); // 결과: '0'console.log(numObj.toFixed(5)); // 결과: '0.00..
foreach문 (C.BRANCH LIKE CONCAT('%',TRIM('${item}'),'%') OR C.PHONE LIKE CONCAT('%',TRIM('${item}'),'%')) mybatis foreach문 지원 태그- collection : 전달받은 인자. 배열(Array) 혹은 리스트(List) 형태만 가능ex)배열 예시String[] testArray={"1", "2", "3"} - 배열 파라미터를 Map을 통해 넘겼을 경우1. DAOpublic ListgetTestList(String[] userArray) { HashMap map =new HashMap(); map.put("testArray",testArray); return sqlSession.selectList("..

* Collection Collections.swap( list, index1, index2 ) Collections.swap( list, index1, index2 ) 는 리스트에서 index1과 index2의 위치를 바꾼다import java.util.Arrays;import java.util.Collections;import java.util.List;public class Example { public static void main(String[] args) { List words = Arrays.asList("A", "B", "C", "D"); Collections.swap(words, 0, 3); System.out.println(words); //..
find()find() 메소드는 주어진 테스트 함수의 조건을 만족하는 첫 번째 요소 값을 반환조건에 맞는 요소를 찾을 수 없다면 undefined를 반환find()는 호출되는 배열을 변경하지 않음var arr = ['A', 'B', 'C', 'A'];arr.find((item) => item == "A"); // A (arr[0])arr.find((item) => item == "D"); // undefined findIndex()findIndex() 메소드는 주어진 함수를 통과한 첫 번째 요소의 인덱스 값을 반환조건에 맞는 요소를 찾을 수 없다면 -1을 반환findIndex()는 호출되는 배열을 변경하지 않음var arr = [1,5,6,3,4,7];var evenIndex = arr.findIndex..
1.$("input[name='test']") → 'test' 라는 name으로 접근 2. ^= ~로 시작하는$("input[name^='test']") → 'test' 로 시작하는 name 접근(쿼리에서 LIKE 'test%' 와 동일)3. *= ~포함된$("input[name*='test']") → 'test' 로 포함된 name 접근(쿼리에서 LIKE ' %test%' 와 동일)4. $= ~로 끝나는$("input[name$='test']") → 'test' 로 끝나는 name 접근(쿼리에서 LIKE ' %test' 와 동일)
extend() 다수의 객체를 하나의 객체로 합친다. - $.extend (대상, 객체1, 객체2, ... , 객체n) - 객체가 동일한 프로퍼티를 가지게 되는 경우 나중에 덮어씌어지는 값이 최종값으로 남게 된다 objA = { a: 1, b: 2 }objB = { b: 3, c: 4 }objC = $.extend({}, objA, objB); // { a: 1, b: 3, c: 4 }// objC['a'] = 1// objC['b'] = 3 objB의 b값으로 덮어씌워짐// objC['c'] = 4 objA = { a: '1', b: { b1: 100, b2: 200}}objB = {b: { b2: 300, b3: 300}, c: '4'}objC = $.extend({}, objA, objB);o..
문자열로 변환1. String()var tt = 2alert(typeof tt); // Result : numbertt = String(tt);alert(typeof tt); // Result : string 2. 숫자에 문자열 더하기var tt = 2tt += "";alert(typeof tt); // Result : string 3. toString()var tt = 2; // Numbertt = tt.toString();console.log(typeof tt); // Stringvar arr = ['today', 'yesterday', 'hello', '1', 'bye'].toString();console.log(arr); // "today,yesterday,hello,1,bye"숫..
1. bind(eventType,handler) - 이벤트 등록 - id가 btn이라는 요소에 이벤트 핸들러를 추가한다.- eventType은 click, handler는 클릭이라는 문구를 출력하는 alert 창이 나오도록 함수를 지정한다- id가 btn요소를 클릭 시 '클릭' 문구가 나오는 alert창이 뜬다 2. unbind( [eventType] [, handler] ) - 이벤트 제거 - id가 btn인 요소에 추가된 이벤트를 제거한다.- 매개변수가 없으면 모든 이벤트 제거- eventType 지정시 지정된 이벤트 제거- handler 지정시 click에 대한 이벤트는 남아있어도 핸들러에 해당되는 부분이 제거