this tutorialの後に、一意の番号が配列オブジェクト内にある場合は「検出」します。この番号は文字列です。'instanceof'の右側が呼び出し可能ではありません
ES6:私はので、私は等価探し(JavaScriptの)と反応Ruby on Railsにでdetect
に慣れ
現実に
...
// this will be "data" in "this.props.data"
data = [
{
id: 1,
order_id: "44",
name: "Some order number name",
},
{
id: 2,
order_id: "65",
...,
}
]
// let num = "44"; Just for this example
renderCreditNote(num){
if (num instanceof this.props.data) {
return num.map(function(p){
return p.order_id
});
}
}
render(){
return({this.renderCreditNote().bind(this)})
}
...
、これは次のようになります。 this.renderCreditNote(this.state.num).bind(this)
このnum
が配列内にある場合は、その配列のみを表示します。私はこれを正しい方法でやっていますか?エラーは次のとおりです。
Uncaught TypeError: Right-hand side of 'instanceof' is not callable
あなたは[array.includes]必要なように見える(https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/配列/インクルード)、ここでは 'instanceof'ではありません。 – georg
array.includesはどのように配列/オブジェクトを処理しますか?私はそれが動作する整数のリストを持っているが、それは入れ子になったオブジェクトのチェックを処理するのか知っていますか? –
Sylar、もし私が正しく理解していれば、 'this.props.data'は何の配列ですか?そして、あなたは1. 'num'が配列内にあるかどうかをチェックし、' order_id'を返すのであれば?モバイル上の –