How to check if object is in json?
I am using google maps autocomplete and I am retrieving each object in a field like this:
$("#usp-custom-21").val(arrAddress.filter(x => x.types.includes("route"))[0].long_name);
$("#usp-custom-22").val(arrAddress.filter(x => x.types.includes("street_number"))[0].long_name);
$("#usp-custom-23").val(arrAddress.filter(x => x.types.includes("locality"))[0].long_name);
$("#usp-custom-8").attr("value", arrAddress.filter(x => x.types.includes("country"))[0].long_name);
$("#usp-custom-25").val(arrAddress.filter(x => x.types.includes("postal_code"))[0].long_name);
But it does happen that sometimes we don't have some or all of those fields, and we get this error:
Uncaught TypeError: Cannot read property 'long_name' of undefined
I am trying to do a conditional by checking if these fields are there or not, and I tried both checking for an undefined
or simply if it is there:
if(arrAddress.filter(x => x.types.includes("route"))[0] != "undefined") {
$("#usp-custom-21").val(arrAddress.filter(x => x.types.includes("route"))[0].long_name);
}
if(arrAddress.filter(x => x.types.includes("street_number"))[0].long_name){
$("#usp-custom-22").val(arrAddress.filter(x => x.types.includes("street_number"))[0].long_name);
}
But I still get:
Uncaught TypeError: Cannot read property 'long_name' of undefined
And it refers to the string long_name
inside the if
Full code:
autocomplete.addListener('place_changed', function() {
var place = autocomplete.getPlace();
if (!place.geometry) {
return;
}
if (place.geometry.viewport) {
map.fitBounds(place.geometry.viewport);
} else {
map.setCenter(place.geometry.location);
}
marker.setPosition(place.geometry.location);
currentLatitude = place.geometry.location.lat();
currentLongitude = place.geometry.location.lng();
var arrAddress = place.address_components;
var Newlat = map.getCenter().lat();
var NewLong = map.getCenter().lng();
$("#usp-custom-19").val(parseInt(Newlat));
$("#usp-custom-20").val(parseInt(NewLong));
if(arrAddress.filter(x => x.types.includes("route"))[0] != "undefined") {
$("#usp-custom-21").val(arrAddress.filter(x => x.types.includes("route"))[0].long_name);
}
if(arrAddress.filter(x => x.types.includes("street_number"))[0].long_name){
$("#usp-custom-22").val(arrAddress.filter(x => x.types.includes("street_number"))[0].long_name);
}
if(arrAddress.filter(x => x.types.includes("locality"))[0].long_name) {
$("#usp-custom-23").val(arrAddress.filter(x => x.types.includes("locality"))[0].long_name);
}
if(arrAddress.filter(x => x.types.includes("country"))[0].long_name) {
$("#usp-custom-8").val(arrAddress.filter(x => x.types.includes("country"))[0].long_name);
}
if(arrAddress.filter(x => x.types.includes("postal_code"))[0].long_name) {
$("#usp-custom-25").val(arrAddress.filter(x => x.types.includes("postal_code"))[0].long_name);
}
if(place.formatted_address) {
$("#usp-custom-60").val(place.formatted_address);
}
$("#usp-custom-90").val(Newlat+","+NewLong);
console.log(place.formatted_address);
});
javascript jquery google-maps autocomplete
add a comment |
I am using google maps autocomplete and I am retrieving each object in a field like this:
$("#usp-custom-21").val(arrAddress.filter(x => x.types.includes("route"))[0].long_name);
$("#usp-custom-22").val(arrAddress.filter(x => x.types.includes("street_number"))[0].long_name);
$("#usp-custom-23").val(arrAddress.filter(x => x.types.includes("locality"))[0].long_name);
$("#usp-custom-8").attr("value", arrAddress.filter(x => x.types.includes("country"))[0].long_name);
$("#usp-custom-25").val(arrAddress.filter(x => x.types.includes("postal_code"))[0].long_name);
But it does happen that sometimes we don't have some or all of those fields, and we get this error:
Uncaught TypeError: Cannot read property 'long_name' of undefined
I am trying to do a conditional by checking if these fields are there or not, and I tried both checking for an undefined
or simply if it is there:
if(arrAddress.filter(x => x.types.includes("route"))[0] != "undefined") {
$("#usp-custom-21").val(arrAddress.filter(x => x.types.includes("route"))[0].long_name);
}
if(arrAddress.filter(x => x.types.includes("street_number"))[0].long_name){
$("#usp-custom-22").val(arrAddress.filter(x => x.types.includes("street_number"))[0].long_name);
}
But I still get:
Uncaught TypeError: Cannot read property 'long_name' of undefined
And it refers to the string long_name
inside the if
Full code:
autocomplete.addListener('place_changed', function() {
var place = autocomplete.getPlace();
if (!place.geometry) {
return;
}
if (place.geometry.viewport) {
map.fitBounds(place.geometry.viewport);
} else {
map.setCenter(place.geometry.location);
}
marker.setPosition(place.geometry.location);
currentLatitude = place.geometry.location.lat();
currentLongitude = place.geometry.location.lng();
var arrAddress = place.address_components;
var Newlat = map.getCenter().lat();
var NewLong = map.getCenter().lng();
$("#usp-custom-19").val(parseInt(Newlat));
$("#usp-custom-20").val(parseInt(NewLong));
if(arrAddress.filter(x => x.types.includes("route"))[0] != "undefined") {
$("#usp-custom-21").val(arrAddress.filter(x => x.types.includes("route"))[0].long_name);
}
if(arrAddress.filter(x => x.types.includes("street_number"))[0].long_name){
$("#usp-custom-22").val(arrAddress.filter(x => x.types.includes("street_number"))[0].long_name);
}
if(arrAddress.filter(x => x.types.includes("locality"))[0].long_name) {
$("#usp-custom-23").val(arrAddress.filter(x => x.types.includes("locality"))[0].long_name);
}
if(arrAddress.filter(x => x.types.includes("country"))[0].long_name) {
$("#usp-custom-8").val(arrAddress.filter(x => x.types.includes("country"))[0].long_name);
}
if(arrAddress.filter(x => x.types.includes("postal_code"))[0].long_name) {
$("#usp-custom-25").val(arrAddress.filter(x => x.types.includes("postal_code"))[0].long_name);
}
if(place.formatted_address) {
$("#usp-custom-60").val(place.formatted_address);
}
$("#usp-custom-90").val(Newlat+","+NewLong);
console.log(place.formatted_address);
});
javascript jquery google-maps autocomplete
add a comment |
I am using google maps autocomplete and I am retrieving each object in a field like this:
$("#usp-custom-21").val(arrAddress.filter(x => x.types.includes("route"))[0].long_name);
$("#usp-custom-22").val(arrAddress.filter(x => x.types.includes("street_number"))[0].long_name);
$("#usp-custom-23").val(arrAddress.filter(x => x.types.includes("locality"))[0].long_name);
$("#usp-custom-8").attr("value", arrAddress.filter(x => x.types.includes("country"))[0].long_name);
$("#usp-custom-25").val(arrAddress.filter(x => x.types.includes("postal_code"))[0].long_name);
But it does happen that sometimes we don't have some or all of those fields, and we get this error:
Uncaught TypeError: Cannot read property 'long_name' of undefined
I am trying to do a conditional by checking if these fields are there or not, and I tried both checking for an undefined
or simply if it is there:
if(arrAddress.filter(x => x.types.includes("route"))[0] != "undefined") {
$("#usp-custom-21").val(arrAddress.filter(x => x.types.includes("route"))[0].long_name);
}
if(arrAddress.filter(x => x.types.includes("street_number"))[0].long_name){
$("#usp-custom-22").val(arrAddress.filter(x => x.types.includes("street_number"))[0].long_name);
}
But I still get:
Uncaught TypeError: Cannot read property 'long_name' of undefined
And it refers to the string long_name
inside the if
Full code:
autocomplete.addListener('place_changed', function() {
var place = autocomplete.getPlace();
if (!place.geometry) {
return;
}
if (place.geometry.viewport) {
map.fitBounds(place.geometry.viewport);
} else {
map.setCenter(place.geometry.location);
}
marker.setPosition(place.geometry.location);
currentLatitude = place.geometry.location.lat();
currentLongitude = place.geometry.location.lng();
var arrAddress = place.address_components;
var Newlat = map.getCenter().lat();
var NewLong = map.getCenter().lng();
$("#usp-custom-19").val(parseInt(Newlat));
$("#usp-custom-20").val(parseInt(NewLong));
if(arrAddress.filter(x => x.types.includes("route"))[0] != "undefined") {
$("#usp-custom-21").val(arrAddress.filter(x => x.types.includes("route"))[0].long_name);
}
if(arrAddress.filter(x => x.types.includes("street_number"))[0].long_name){
$("#usp-custom-22").val(arrAddress.filter(x => x.types.includes("street_number"))[0].long_name);
}
if(arrAddress.filter(x => x.types.includes("locality"))[0].long_name) {
$("#usp-custom-23").val(arrAddress.filter(x => x.types.includes("locality"))[0].long_name);
}
if(arrAddress.filter(x => x.types.includes("country"))[0].long_name) {
$("#usp-custom-8").val(arrAddress.filter(x => x.types.includes("country"))[0].long_name);
}
if(arrAddress.filter(x => x.types.includes("postal_code"))[0].long_name) {
$("#usp-custom-25").val(arrAddress.filter(x => x.types.includes("postal_code"))[0].long_name);
}
if(place.formatted_address) {
$("#usp-custom-60").val(place.formatted_address);
}
$("#usp-custom-90").val(Newlat+","+NewLong);
console.log(place.formatted_address);
});
javascript jquery google-maps autocomplete
I am using google maps autocomplete and I am retrieving each object in a field like this:
$("#usp-custom-21").val(arrAddress.filter(x => x.types.includes("route"))[0].long_name);
$("#usp-custom-22").val(arrAddress.filter(x => x.types.includes("street_number"))[0].long_name);
$("#usp-custom-23").val(arrAddress.filter(x => x.types.includes("locality"))[0].long_name);
$("#usp-custom-8").attr("value", arrAddress.filter(x => x.types.includes("country"))[0].long_name);
$("#usp-custom-25").val(arrAddress.filter(x => x.types.includes("postal_code"))[0].long_name);
But it does happen that sometimes we don't have some or all of those fields, and we get this error:
Uncaught TypeError: Cannot read property 'long_name' of undefined
I am trying to do a conditional by checking if these fields are there or not, and I tried both checking for an undefined
or simply if it is there:
if(arrAddress.filter(x => x.types.includes("route"))[0] != "undefined") {
$("#usp-custom-21").val(arrAddress.filter(x => x.types.includes("route"))[0].long_name);
}
if(arrAddress.filter(x => x.types.includes("street_number"))[0].long_name){
$("#usp-custom-22").val(arrAddress.filter(x => x.types.includes("street_number"))[0].long_name);
}
But I still get:
Uncaught TypeError: Cannot read property 'long_name' of undefined
And it refers to the string long_name
inside the if
Full code:
autocomplete.addListener('place_changed', function() {
var place = autocomplete.getPlace();
if (!place.geometry) {
return;
}
if (place.geometry.viewport) {
map.fitBounds(place.geometry.viewport);
} else {
map.setCenter(place.geometry.location);
}
marker.setPosition(place.geometry.location);
currentLatitude = place.geometry.location.lat();
currentLongitude = place.geometry.location.lng();
var arrAddress = place.address_components;
var Newlat = map.getCenter().lat();
var NewLong = map.getCenter().lng();
$("#usp-custom-19").val(parseInt(Newlat));
$("#usp-custom-20").val(parseInt(NewLong));
if(arrAddress.filter(x => x.types.includes("route"))[0] != "undefined") {
$("#usp-custom-21").val(arrAddress.filter(x => x.types.includes("route"))[0].long_name);
}
if(arrAddress.filter(x => x.types.includes("street_number"))[0].long_name){
$("#usp-custom-22").val(arrAddress.filter(x => x.types.includes("street_number"))[0].long_name);
}
if(arrAddress.filter(x => x.types.includes("locality"))[0].long_name) {
$("#usp-custom-23").val(arrAddress.filter(x => x.types.includes("locality"))[0].long_name);
}
if(arrAddress.filter(x => x.types.includes("country"))[0].long_name) {
$("#usp-custom-8").val(arrAddress.filter(x => x.types.includes("country"))[0].long_name);
}
if(arrAddress.filter(x => x.types.includes("postal_code"))[0].long_name) {
$("#usp-custom-25").val(arrAddress.filter(x => x.types.includes("postal_code"))[0].long_name);
}
if(place.formatted_address) {
$("#usp-custom-60").val(place.formatted_address);
}
$("#usp-custom-90").val(Newlat+","+NewLong);
console.log(place.formatted_address);
});
javascript jquery google-maps autocomplete
javascript jquery google-maps autocomplete
asked Nov 21 '18 at 16:03
rob.mrob.m
3,755113983
3,755113983
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Try this:
if(arrAddress.filter(x => x.types.includes("route"))[0] != undefined) {
$("#usp-custom-21").val(arrAddress.filter(x => x.types.includes("route"))[0].long_name);
}
if(arrAddress.filter(x => x.types.includes("street_number"))[0] != undefined){
$("#usp-custom-22").val(arrAddress.filter(x => x.types.includes("street_number"))[0].long_name);
}
I don't know why the downvote, yet it is working by checking undefined without quotes around. if anyone could tell me why this answer isn't right, I'd appreciate it
– rob.m
Nov 21 '18 at 16:09
1
that is what I say ...
– javimovi
Nov 21 '18 at 16:10
If you have solved this answer your question, please mark it as corrected
– javimovi
Nov 21 '18 at 16:13
will do as soon as it let me
– rob.m
Nov 21 '18 at 16:13
add a comment |
Have you tried this?
if(arrAddress.filter(x => x.types.includes("route"))[0].long_name != "undefined") {
$("#usp-custom-21").val(arrAddress.filter(x => x.types.includes("route"))[0].long_name);
}
You may also want to check for NaN or null types. Use typeof to figure out a type when it's failing:
console.log(typeof x.types.includes("route"))[0])
or
console.log(typeof x.types.includes("route"))[0].long_name)
yes I have, only with undefined without quotes is working as per the other answer
– rob.m
Nov 21 '18 at 16:12
Shame on me, missed these quotes
– Denis Kovzelyuk
Nov 21 '18 at 16:16
also console.log(typeof x.types.includes("route")[0]) is giving Uncaught ReferenceError: x is not defined
– rob.m
Nov 21 '18 at 16:17
Did you put it inside the closure?
– Denis Kovzelyuk
Nov 21 '18 at 16:23
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53416027%2fhow-to-check-if-object-is-in-json%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Try this:
if(arrAddress.filter(x => x.types.includes("route"))[0] != undefined) {
$("#usp-custom-21").val(arrAddress.filter(x => x.types.includes("route"))[0].long_name);
}
if(arrAddress.filter(x => x.types.includes("street_number"))[0] != undefined){
$("#usp-custom-22").val(arrAddress.filter(x => x.types.includes("street_number"))[0].long_name);
}
I don't know why the downvote, yet it is working by checking undefined without quotes around. if anyone could tell me why this answer isn't right, I'd appreciate it
– rob.m
Nov 21 '18 at 16:09
1
that is what I say ...
– javimovi
Nov 21 '18 at 16:10
If you have solved this answer your question, please mark it as corrected
– javimovi
Nov 21 '18 at 16:13
will do as soon as it let me
– rob.m
Nov 21 '18 at 16:13
add a comment |
Try this:
if(arrAddress.filter(x => x.types.includes("route"))[0] != undefined) {
$("#usp-custom-21").val(arrAddress.filter(x => x.types.includes("route"))[0].long_name);
}
if(arrAddress.filter(x => x.types.includes("street_number"))[0] != undefined){
$("#usp-custom-22").val(arrAddress.filter(x => x.types.includes("street_number"))[0].long_name);
}
I don't know why the downvote, yet it is working by checking undefined without quotes around. if anyone could tell me why this answer isn't right, I'd appreciate it
– rob.m
Nov 21 '18 at 16:09
1
that is what I say ...
– javimovi
Nov 21 '18 at 16:10
If you have solved this answer your question, please mark it as corrected
– javimovi
Nov 21 '18 at 16:13
will do as soon as it let me
– rob.m
Nov 21 '18 at 16:13
add a comment |
Try this:
if(arrAddress.filter(x => x.types.includes("route"))[0] != undefined) {
$("#usp-custom-21").val(arrAddress.filter(x => x.types.includes("route"))[0].long_name);
}
if(arrAddress.filter(x => x.types.includes("street_number"))[0] != undefined){
$("#usp-custom-22").val(arrAddress.filter(x => x.types.includes("street_number"))[0].long_name);
}
Try this:
if(arrAddress.filter(x => x.types.includes("route"))[0] != undefined) {
$("#usp-custom-21").val(arrAddress.filter(x => x.types.includes("route"))[0].long_name);
}
if(arrAddress.filter(x => x.types.includes("street_number"))[0] != undefined){
$("#usp-custom-22").val(arrAddress.filter(x => x.types.includes("street_number"))[0].long_name);
}
answered Nov 21 '18 at 16:07
javimovijavimovi
318110
318110
I don't know why the downvote, yet it is working by checking undefined without quotes around. if anyone could tell me why this answer isn't right, I'd appreciate it
– rob.m
Nov 21 '18 at 16:09
1
that is what I say ...
– javimovi
Nov 21 '18 at 16:10
If you have solved this answer your question, please mark it as corrected
– javimovi
Nov 21 '18 at 16:13
will do as soon as it let me
– rob.m
Nov 21 '18 at 16:13
add a comment |
I don't know why the downvote, yet it is working by checking undefined without quotes around. if anyone could tell me why this answer isn't right, I'd appreciate it
– rob.m
Nov 21 '18 at 16:09
1
that is what I say ...
– javimovi
Nov 21 '18 at 16:10
If you have solved this answer your question, please mark it as corrected
– javimovi
Nov 21 '18 at 16:13
will do as soon as it let me
– rob.m
Nov 21 '18 at 16:13
I don't know why the downvote, yet it is working by checking undefined without quotes around. if anyone could tell me why this answer isn't right, I'd appreciate it
– rob.m
Nov 21 '18 at 16:09
I don't know why the downvote, yet it is working by checking undefined without quotes around. if anyone could tell me why this answer isn't right, I'd appreciate it
– rob.m
Nov 21 '18 at 16:09
1
1
that is what I say ...
– javimovi
Nov 21 '18 at 16:10
that is what I say ...
– javimovi
Nov 21 '18 at 16:10
If you have solved this answer your question, please mark it as corrected
– javimovi
Nov 21 '18 at 16:13
If you have solved this answer your question, please mark it as corrected
– javimovi
Nov 21 '18 at 16:13
will do as soon as it let me
– rob.m
Nov 21 '18 at 16:13
will do as soon as it let me
– rob.m
Nov 21 '18 at 16:13
add a comment |
Have you tried this?
if(arrAddress.filter(x => x.types.includes("route"))[0].long_name != "undefined") {
$("#usp-custom-21").val(arrAddress.filter(x => x.types.includes("route"))[0].long_name);
}
You may also want to check for NaN or null types. Use typeof to figure out a type when it's failing:
console.log(typeof x.types.includes("route"))[0])
or
console.log(typeof x.types.includes("route"))[0].long_name)
yes I have, only with undefined without quotes is working as per the other answer
– rob.m
Nov 21 '18 at 16:12
Shame on me, missed these quotes
– Denis Kovzelyuk
Nov 21 '18 at 16:16
also console.log(typeof x.types.includes("route")[0]) is giving Uncaught ReferenceError: x is not defined
– rob.m
Nov 21 '18 at 16:17
Did you put it inside the closure?
– Denis Kovzelyuk
Nov 21 '18 at 16:23
add a comment |
Have you tried this?
if(arrAddress.filter(x => x.types.includes("route"))[0].long_name != "undefined") {
$("#usp-custom-21").val(arrAddress.filter(x => x.types.includes("route"))[0].long_name);
}
You may also want to check for NaN or null types. Use typeof to figure out a type when it's failing:
console.log(typeof x.types.includes("route"))[0])
or
console.log(typeof x.types.includes("route"))[0].long_name)
yes I have, only with undefined without quotes is working as per the other answer
– rob.m
Nov 21 '18 at 16:12
Shame on me, missed these quotes
– Denis Kovzelyuk
Nov 21 '18 at 16:16
also console.log(typeof x.types.includes("route")[0]) is giving Uncaught ReferenceError: x is not defined
– rob.m
Nov 21 '18 at 16:17
Did you put it inside the closure?
– Denis Kovzelyuk
Nov 21 '18 at 16:23
add a comment |
Have you tried this?
if(arrAddress.filter(x => x.types.includes("route"))[0].long_name != "undefined") {
$("#usp-custom-21").val(arrAddress.filter(x => x.types.includes("route"))[0].long_name);
}
You may also want to check for NaN or null types. Use typeof to figure out a type when it's failing:
console.log(typeof x.types.includes("route"))[0])
or
console.log(typeof x.types.includes("route"))[0].long_name)
Have you tried this?
if(arrAddress.filter(x => x.types.includes("route"))[0].long_name != "undefined") {
$("#usp-custom-21").val(arrAddress.filter(x => x.types.includes("route"))[0].long_name);
}
You may also want to check for NaN or null types. Use typeof to figure out a type when it's failing:
console.log(typeof x.types.includes("route"))[0])
or
console.log(typeof x.types.includes("route"))[0].long_name)
edited Nov 21 '18 at 16:14
answered Nov 21 '18 at 16:11


Denis KovzelyukDenis Kovzelyuk
716
716
yes I have, only with undefined without quotes is working as per the other answer
– rob.m
Nov 21 '18 at 16:12
Shame on me, missed these quotes
– Denis Kovzelyuk
Nov 21 '18 at 16:16
also console.log(typeof x.types.includes("route")[0]) is giving Uncaught ReferenceError: x is not defined
– rob.m
Nov 21 '18 at 16:17
Did you put it inside the closure?
– Denis Kovzelyuk
Nov 21 '18 at 16:23
add a comment |
yes I have, only with undefined without quotes is working as per the other answer
– rob.m
Nov 21 '18 at 16:12
Shame on me, missed these quotes
– Denis Kovzelyuk
Nov 21 '18 at 16:16
also console.log(typeof x.types.includes("route")[0]) is giving Uncaught ReferenceError: x is not defined
– rob.m
Nov 21 '18 at 16:17
Did you put it inside the closure?
– Denis Kovzelyuk
Nov 21 '18 at 16:23
yes I have, only with undefined without quotes is working as per the other answer
– rob.m
Nov 21 '18 at 16:12
yes I have, only with undefined without quotes is working as per the other answer
– rob.m
Nov 21 '18 at 16:12
Shame on me, missed these quotes
– Denis Kovzelyuk
Nov 21 '18 at 16:16
Shame on me, missed these quotes
– Denis Kovzelyuk
Nov 21 '18 at 16:16
also console.log(typeof x.types.includes("route")[0]) is giving Uncaught ReferenceError: x is not defined
– rob.m
Nov 21 '18 at 16:17
also console.log(typeof x.types.includes("route")[0]) is giving Uncaught ReferenceError: x is not defined
– rob.m
Nov 21 '18 at 16:17
Did you put it inside the closure?
– Denis Kovzelyuk
Nov 21 '18 at 16:23
Did you put it inside the closure?
– Denis Kovzelyuk
Nov 21 '18 at 16:23
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53416027%2fhow-to-check-if-object-is-in-json%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown