[英]Cannot call method 'toUpperCase' of undefined in simple React/Jest test
[英]Cannot call method toUpperCase of undefined
if (json.ScheduleCareProviderScheduledPatientsGetResult.Appointments[i].Patient.Firstname.toUpperCase().indexOf(searchBarValue.toUpperCase()) == 0) {
为什么我会收到此错误。
因为
json.ScheduleCareProviderScheduledPatientsGetResult.Appointments[i].Patient.Firstname
未定义。
json.ScheduleCareProviderScheduledPatientsGetResult.Appointments[i].Patient.Firstname
searchBarValue
或searchBarValue
未定义。 在打电话之前确保它们不是null
!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.