+ 2

When do we use of "new" in js??

9th Mar 2018, 4:12 PM
Sina
Sina - avatar
6 Answers
+ 1
think to create new object
9th Mar 2018, 4:44 PM
Ronald Mbanjwa
Ronald Mbanjwa - avatar
0
to tell the program you're declaring an object. var STR=new string("hello"); alert(typeof STR ); output::string?hell no object? yes
9th Mar 2018, 4:40 PM
᠌᠌Code X
᠌᠌Code X - avatar
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
9th Mar 2018, 4:56 PM
Sina
Sina - avatar
0
👆👆
9th Mar 2018, 4:56 PM
Sina
Sina - avatar
0
var date = new Date();
9th Mar 2018, 5:22 PM
Silk_Road
Silk_Road - avatar