File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -35,20 +35,20 @@ async function initMap() {
3535 } ) ;
3636
3737 // If there are any reviews display the first one.
38- if ( place . reviews ) {
38+ if ( place . reviews && place . reviews . length > 0 ) {
3939 // Get info for the first review.
4040 let reviewRating = place . reviews [ 0 ] . rating ;
4141 let reviewText = place . reviews [ 0 ] . text ;
4242 let authorName = place . reviews [ 0 ] . authorAttribution ! . displayName ;
4343 let authorUri = place . reviews [ 0 ] . authorAttribution ! . uri ;
4444
4545 // Format the review using HTML.
46- contentString =
47- ' <div id="title"><b>' + place . displayName + ' </b></div>' +
48- ' <div id="address">' + place . formattedAddress + ' </div>' +
49- ' <a href="' + authorUri + ' " target="_blank">Author: ' + authorName + ' </a>' +
50- ' <div id="rating">Rating: ' + reviewRating + ' stars</div>' +
51- ' <div id="rating"><p>Review: ' + reviewText + ' </p></div>' ;
46+ contentString = `
47+ <div id="title"><b>${ place . displayName } </b></div>
48+ <div id="address">${ place . formattedAddress } </div>
49+ <a href="${ authorUri } " target="_blank">Author: ${ authorName } </a>
50+ <div id="rating">Rating: ${ reviewRating } stars</div>
51+ <div id="rating"><p>Review: ${ reviewText } </p></div>` ;
5252 } else {
5353 contentString = 'No reviews were found for ' + place . displayName + '.' ;
5454 }
You can’t perform that action at this time.
0 commit comments