댓글 검색 목록

[javascript] 지정된 문자열의 지정된 위치에있는 문자를 제거하고 새 문자열을 반환하는 JavaScript 프로그램을 작성하십시오.

페이지 정보

작성자 운영자 작성일 17-12-29 22:33 조회 1,346 댓글 0

코드 :

function remove_character(str, char_pos) 
 {
  part1 = str.substring(0, char_pos);
  part2 = str.substring(char_pos + 1, str.length);
  return (part1 + part2);
 }

console.log(remove_character("Python",0));
console.log(remove_character("Python",3));
console.log(remove_character("Python",5));

결과 :

ython

Pyton

Pytho



댓글목록 0

등록된 댓글이 없습니다.

웹학교 로고

온라인 코딩학교

코리아뉴스 2001 - , All right reserved.