Jquery – Microsoft JScript runtime error: Unable to get value of the property ‘toLowerCase’: object is null or undefined

jquery

Microsoft JScript runtime error: Unable to get value of the property 'toLowerCase': object is null or undefined

//--Customer Reviews
//--Display when current locale is EN-US
var IsReviewable = $(".tab-content-doc:eq(2) span")[0].innerText || $(".tab-content-doc:eq(2) span")[0].textContent;
if (IsReviewable.toLowerCase() == "true" && currentLocale()=="en-us" ) {            
   $("ul.tabs li").eq(2).show();
   $("#BVRRSummaryContainer").show();            
}   

I try to execute the code and this error is showing. It gives me three options: Break,Continue and Ignore. If i continue then it will not display Customer Reviews but if i ignore then it display Customer Review.I need to display Customer Review. How can i get that? Its running on Internet Explorer 9.
Any Suggestions?

Best Solution

Change your condition to

if (IsReviewable &&  IsReviewable.toLowerCase() == "true" && currentLocale()=="en-us" ) 

This will make sure the value is not falsy and only then apply the toLowerCase method