EDIT: Existing answers are 2 and 5 years old (from 2017 and 2014).
How can I shorten the following statement
ratingsExisting(): boolean {
return (
this.fromAPIData.book &&
this.fromAPIData.book.misc &&
this.fromAPIData.book.misc.ratings &&
this.fromAPIData.book.misc.ratings.length > 0
);
}
so that I don't receive errors if any of the properties is null
?