목차


 주어진 변수를 메서드를 사용해 조건과 같이 출력

indexOf(), lastIndexOf, slice() 메서드를 사용해

javaScript

log

php

와 같이 콘솔에 출력

let fileName = "javaScript.log.php";

const first_dot = fileName.indexOf( "." );
const last_dot = fileName.lastIndexOf( "." );
console.log( fileName.slice( 0, first_dot ) );
console.log( fileName.slice( first_dot + 1, last_dot ) );
console.log( fileName.slice( last_dot + 1 ) );

 


 

Github

Link

 

'JavaScript > JavaScript_TEST' 카테고리의 다른 글

timer_TEST  (0) 2023.05.08
DOM_TEST  (0) 2023.05.05
date_TEST  (0) 2023.05.05
math_TEST  (0) 2023.05.05
primeNumber(소수)_TEST  (0) 2023.05.03

+ Recent posts