File tree 1 file changed +7
-7
lines changed
1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -35,20 +35,20 @@ async function initMap() {
35
35
} ) ;
36
36
37
37
// If there are any reviews display the first one.
38
- if ( place . reviews ) {
38
+ if ( place . reviews && place . reviews . length > 0 ) {
39
39
// Get info for the first review.
40
40
let reviewRating = place . reviews [ 0 ] . rating ;
41
41
let reviewText = place . reviews [ 0 ] . text ;
42
42
let authorName = place . reviews [ 0 ] . authorAttribution ! . displayName ;
43
43
let authorUri = place . reviews [ 0 ] . authorAttribution ! . uri ;
44
44
45
45
// 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>` ;
52
52
} else {
53
53
contentString = 'No reviews were found for ' + place . displayName + '.' ;
54
54
}
You can’t perform that action at this time.
0 commit comments