inflearn logo
강의

Course

Instructor

[Code Camp] Highly concentrated backend course created at boot camp

unexpected end of input

Resolved

1001

SW

5 asked

0

 console.log("안녕하세요, 문자 인증번호 보내드립니다.")

function createTokenOfPhone(myphone){
    if(myphone.length !== 10 &&  myphone.length !== 11){
        console.log("에러 발생! 핸드폰 번호를 제대로 입력해 주세요. ")
        return
    }

    const aaaa=6
    if(aaaa ===  undefined){
        console.log("에러 발생!!! 갯수를 제대로 입력해 주세요!!!")
        return
    } else if(aaaa <= 0){
        console.log("에러 발생!! 갯수가 너무 적습니다!!")
        return
    }else if(aaaa > 10){
        console.log("에러 발생!!! 갯수가 너무 많습니다!!!")
        return
    }
    const result = String(Math.floor(Math.random() * 10 ** aaaa)).padStart(aaaa,"0")
    console.log(result)

    console.log(myphone+ "번호로 인증번호" +result+ "를 전송합니다!!!")

createTokenOfPhone("01012341234")

 

수업과 동일하게 코드를 작성했으나 아래와 같은 에러가 뜹니다.

 

(base) c@Dui-c-G9C7V6620L 01-01-token % node index.js

/Users/c/Desktop/codecamp-backend-03./class/01-01-token/index.js:25

createTokenOfPhone("01012341234")

SyntaxError: Unexpected end of input

at internalCompileFunction (node:internal/vm:73:18)

at wrapSafe (node:internal/modules/cjs/loader:1176:20)

at Module._compile (node:internal/modules/cjs/loader:1218:27)

at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)

at Module.load (node:internal/modules/cjs/loader:1117:32)

at Module._load (node:internal/modules/cjs/loader:958:12)

at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)

at node:internal/main/run_main_module:23:47


javascript node.js express docker tdd rest-api nestjs

Answer 1

0

otter

안녕하세요 SW님!

올려주신 질문의 내용과 코드를 확인해 보았을 때, createTokenOfPhone 함수가 올바르게 작성되지 않았기 때문으로 보여집니다! 함께 올려주신 코드의 경우 createTokenOfPhone 함수를 닫아주는 중괄호가 하나 부족한 것으로 보여지니 추가해 보시길 바랍니다.

또한 해당 에러의 경우 문법적인 문제가 있을 때 자주 보여지는 문구로, 추후 같은 문제 발생시 문법적인 부분, 예를 들어 지금과 같이 열리고 닫힌 중괄호의 개수와 짝이 올바르게 작성 되어 있는지 확인해 보시길 바랍니다.

감사합니다 :)

그래프 ql 문서 사용할때 느낌표 남는거 어떻게 없애나요?

0

84

2

강의 전체 소스 코드를 받고싶습니다.

0

76

2

fontawesome 사용 문의

0

79

2

소스 코드 부탁드립니다~

0

85

2

깃 레포지터리 소스

0

87

2

커리큘럼12.css 정렬 에 나오는 과제 정답알고싶어요

0

74

2

10-01 Entity TypeOrmModule.forRoot 에 entities

0

89

3

강의 버전관련 문의입니다

0

103

2

Ubuntu 설치 관련

0

61

1

schema.gql 질문 드립니다.

0

51

1

서버 재실행시 Many to Many

0

102

3

input 관련 문의

0

90

2

Rest API 보다는 graphql이 주된 내용인데

0

131

2

강의 전체 소스코드 받을수있을까요?

0

156

1

도커볼륨 마운트 관련

0

127

2

findOne 타입스크립트오류

0

109

1

http => htrtps 호출 인증서 신뢰 오류

0

354

1

self-signed certificate in certificate chain 에러 발생

0

418

1

mongoose 설치 오류

0

142

1

특정 API, 특정 IP 허용 (단일경로에 CORS 활성화)

0

283

2

08-06

0

180

3

구조랑 패턴 관련해서 질문

0

125

2

mydocker

0

128

2

coolsms statuscode 2000 인데 전송안돼는 경우 확인.

0

156

1