Suppress “Expected '===' and instead saw '=='.” error in jslint

后端 未结 5 1590
轮回少年
轮回少年 2020-12-29 19:25

How can I stop the error message Expected \'===\' and instead saw \'==\'. from appearing in jslint. Doesn\'t seem to be an option.

5条回答
  •  时光说笑
    2020-12-29 20:02

    same error show me I can fix by using this way

    status.user_profile.toString() === props.props.id.toString() 
    

    I'm using react js give example I'm using something like that

    id = 1
    

    if I excess params show me like this

    params :{ id:"1" }
    

    If I excess this way

    id == params.id // output true
    

    If I excess this way

    id === params.id // output false
    

    because not 100% eqality so show me error in terminal

    Expected '===' and instead saw '=='
    

    So I can think about and fix it by converting same data type like this

    id.toString()  === params.id.toString()  // return true
    

提交回复
热议问题