+ 2
When do we use of "new" in js??
6 Answers
+ 1
think to create new object
0
to tell the program you're declaring an object.
var STR=new string("hello");
alert(typeof STR );
output::string?hell no
object? yes
0
var map;
function initMap() {
map = new google.maps.Map(document.getElementById('map'), {
center: {lat: 20.472, lng: 20.724},
zoom: 15.3
});
}
see this code when I delete "map=new" it doesn't work
0
đđ
0
var date = new Date();