인프런 영문 브랜드 로고
인프런 영문 브랜드 로고

Inflearn Community Q&A

운영자's profile image
운영자

asked

Introduction to Javascript Algorithm Problem Solving (Coding Test Preparation)

3. Extract only numbers

이렇게 한것도 괜찮나요

Written on

·

280

0

안녕하세요 선생님 이렇게 했는데 괜찮나요 

function solution(str){

    let haha= str.replace(/[a-z]/gi, "").replace(/(^0+)/, "");

           return haha ;

 }

            

            let str="g0000en2T0sfdjsifjwep0if32uufklnfwfe8eSoft";

            console.log(solution(str));

javascript코테 준비 같이 해요!

Answer 1

0

codingcamp님의 프로필 이미지
codingcamp
Instructor

안녕하세요^^

네. 정규식을 써도 좋습니다.

운영자's profile image
운영자

asked

Ask a question