undefined Questions

6

Solved

I have two pages - "page 1" and "page 2". On page 1 there's an text-box with a value of e.g. 100 and a button at the end. By pressing the button I want javascript to save the value of the textbox ...
Myxomatosis asked 4/1, 2015 at 12:49

7

Solved

I need to declare a type such that removes the undefined from its property types. Suppose we have: type Type1{ prop?: number; } type Type2{ prop: number | undefined; } type Type3{ prop: numb...
Demurral asked 29/10, 2018 at 16:34

10

Solved

Recently I installed node.js on my Windows 7 machine. On execution of JavaScript, I get an undefined message along with successful execution of the expression. What's wrong here? I have not not...
Screed asked 10/12, 2011 at 15:2

10

Solved

I have a function which I have written which basically looks like this: function getNextCard(searchTerms) { // Setup Some Variables // Do a bunch of logic to pick the next card based on termed ...
Verticillaster asked 23/6, 2016 at 0:53

3

Uncaught (in promise) TypeError: Cannot convert undefined or null to object at Function.keys (<anonymous>) at companion-bubble.js:1465:19726 at Generator.next (<anonymous>) at Ln (c...
Hoffmann asked 13/12, 2022 at 5:49

9

Solved

So Safari keeps yelling at me for one specific error. I'm trying to use Google Maps API and call map.getCenter();. However sometimes, this happens before the map has been fully loaded. So instead...
Buckman asked 18/5, 2011 at 15:8

39

Solved

What is the difference between null and undefined in JavaScript?
Broadcloth asked 22/2, 2011 at 10:30

4

Solved

When I try to alert a negation of variable having undefined value , I get the output as true? alert(undefined); alert(!undefined); The first alert gives undefined and second alert gives true. Is...
Rollie asked 22/8, 2016 at 8:55

1

I am trying to access env variables using a .env file in a VueJS 3 project, following the docs of vue 3 and some issues over here, but nothing seems to work. I already checked, the .env is inside t...
Uella asked 5/3, 2022 at 13:30

2

I'm looking for a way to do undefined coalescing in javascript with booleans. I'm used to doing the following, for, say, positive integers: var x = i1 || i2 || i3 || i4; This is a 'slick' way, b...
Jelly asked 25/11, 2015 at 21:46

5

Solved

I am just wondering why it is not possible to make forEach on array of undefined. Code: var arr = new Array(5); // [undefined x 5] //ES5 forEach arr.forEach(function(elem, index, array) { conso...
Cyclo asked 4/5, 2014 at 18:59

4

Solved

I know it is one of the constant ask question so i get this error 'WorldObject': [Base class undefined (translated from german)] Here is the code which produce this error: ProjectilObject.h: #pragm...
Lindbergh asked 20/5, 2012 at 17:29

3

Solved

So in most cases I've been able to use something similar to these lines, but Javascript has given me this weird result. If I take some value and it turns out to be undefined, when compared to an i...
Babe asked 2/3, 2014 at 22:28

3

We are upgrading to PHP 8.1. A new feature is that an undefined array key throws a warning. Unfortunately this interferes with the ability to easily use associative arrays such as $_SESSION v...
Ruelas asked 7/2, 2022 at 20:40

25

Solved

Why is null considered an object in JavaScript? Is checking if ( object == null ) Do something the same as if ( !object ) Do something ? And also: What is the difference between null a...
Bonnet asked 29/4, 2009 at 5:47

9

Solved

The jQuery Core Style Guidelines suggest two different ways to check whether a variable is defined. Global Variables: typeof variable === "undefined" Local Variables: variable === undefi...
Whish asked 18/1, 2011 at 15:2

31

Solved

Which method of checking if a variable has been initialized is better/correct? (Assuming the variable could hold anything (string, int, object, function, etc.)) if (elem) { // or !elem or if (type...
Serology asked 25/2, 2011 at 3:44

1

Solved

Derived from Canonical question for TypeError Cannot [call method / read property / set property] of null in Google Apps Script Proposed reference for questions like : Why the Execution order of ...
Contractor asked 18/10, 2022 at 9:53

1

Function has a trigger for on form submit having issues with this very first line. Its supposed to grab data from excel sheet to auto-populate into a copy of template function autofillGoogleDo...

5

Solved

I'm facing an issue with the following code. What it basically should do. It should load and parse a given JSON file. And in the RequestListender it should show the ID and the string Hello which ...
Estate asked 1/12, 2015 at 22:29

5

Solved

What's the best way to check if myvar javascript variable === false or not (it may be undefined as well). if (myvar === false) would be fine but myvar could be undefined. Only false value is accep...
Piercy asked 25/9, 2014 at 19:36

3

Solved

In TypeScript, you can annotate a function as returning void: function fn1(): void { // OK } function fn2(): void { // Error return 3; } You can also annotate a function to return undefined:...
Kingdon asked 15/11, 2019 at 22:27

1

I have a function basically like this function foo(): Promise<MyClass | undefined> { if(somethingGoesWrong) { return Promise.resolve(undefined); } return Promise.resolve(new MyClass()); ...
Jampan asked 1/12, 2019 at 3:37

2

Solved

I have a type-class instance like this: instance {-# OVERLAPPABLE #-} (TypeError ( 'Text "Some error")) => SomeClass x where someMethod = undefined This instance exists at the end of...
Prebend asked 27/6, 2022 at 23:13

9

I'm learing JavaScript. I cannot grasp the idea of an empty object. As I understand, there are situations when I need to check a variable whether it holds an object and has a value. So far, I...
Declaration asked 27/1, 2021 at 19:32

© 2022 - 2025 — McMap. All rights reserved.