var maxName = null;
var max = 0;
var salaries = {
"John": 100,
"Pete": 300,
"Mary": 250
};
console.log(maxName);
(function topSalary() {
for(const [name, salary] of Object.entries(salaries)) {
if (max < salary) {
max = salary;
maxName = name;
}
}
return maxName;
})()
console.log(maxName);
function getDaysArray(year, month) {
var numDaysInMonth, daysInWeek, daysIndex, index, i, l, daysArray;
numDaysInMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
daysInWeek = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
daysIndex = { 'Sun': 0, 'Mon': 1, 'Tue': 2, 'Wed': 3, 'Thu': 4, 'Fri': 5, 'Sat': 6 };
index = daysIndex[(new Date(year, month - 1, 1)).toString().split(' ')[0]];
daysArray = [];
for (i = 0, l = numDaysInMonth[month - 1]; i < l; i++) {
daysArray.push({
year: year,
month: month,
number: (i + 1),
day: daysInWeek[index++]
})
if (index == 7) index = 0;
}
return daysArray;
}
console.log(getDaysArray(2019, 7))
<script src="https://maps.googleapis.com/maps/api/js?key=[MY_API_KEY]"></script>
<template>
<div id="map"></div>
</template>
<script>
import GoogleMapsLoader from 'google-maps'
export default {
name: "Map",
mounted: function () {
GoogleMapsLoader.KEY = 'AIzaSyCreM63W1kHeozDLz0WohGhVAC2-PE8vv8';
GoogleMapsLoader.load(function(google) {
let map = new google.maps.Map(document.getElementById('map'), {
zoom: 14,
center: new google.maps.LatLng(59.93, 30.32)
})
})
}
}
</script>
<style scoped>
#map {
height:300px;
width: 100%;
}
</style>