Questions tagged [referenceerror]

Anything related to JavaScript ReferenceError that it is thrown when trying to dereference a variable that has not been declared.

The JavaScript ReferenceError object represents an error when a non-existent variable is referenced. A ReferenceError is thrown when trying to dereference a variable that has not been declared.

470 questions
12
votes
3 answers

Javascript FileReader detection in Safari

I'm aware of the fact that the FileReader Object is not available in Safari 5.0.5. I have a script that uses it and thought that i'd just be able to detect whether the object exists to run some alternate code, as is suggested…
barry
  • 141
  • 1
  • 1
  • 5
12
votes
2 answers

Catch a referenceError in js

I have a textarea where user can enter javascript code which upon press of the button would be passed to eval(). I am having trouble catching the referenceError for cases when a user enters something like this: var myName = Maria; instead of var…
jacobdo
  • 1,245
  • 3
  • 10
  • 28
8
votes
2 answers

Why does false++ produce a SyntaxError in Firefox but a ReferenceError in Chrome?

While trying to debug some faulty piece of JavaScript, I found a line that looks like an obvious mistake in a source file: false++; What I don't undestand is why this statement behaves differently in all browsers. In Chrome, I get a ReferenceError…
Lynn
  • 383
  • 3
  • 9
8
votes
5 answers

Difference TypeError and ReferenceError

What's the differnce between TypeError: ... is undefined and ReferenceError: ... is not defined ?
Evgenij Reznik
  • 16,046
  • 33
  • 87
  • 157
8
votes
3 answers

ReferenceError and the global object

In javascript window is the global object, which means every object in the global scope is a child of window. So why I get this result: console.log(window.foo); // No error, logs "undefined". console.log(foo); // Uncaught ReferenceError: foo…
gdoron is supporting Monica
  • 136,782
  • 49
  • 273
  • 342
7
votes
1 answer

Is new super.constructor a valid expression in JavaScript?

I would like to know if expressions of the form new super.SomeProperty are valid in JavaScript. This question arose while working with code that behaves inconsistently across browsers like the example in the snippet below. class Test { test()…
GOTO 0
  • 28,453
  • 18
  • 97
  • 127
7
votes
2 answers

Why is my mocha/chai Error throwing test failing?

I have a simple javascript package I'm trying to test. I want to check for an Error being thrown, but when my test is run, and the error is thrown, the test is marked as failing. Here's the code: var should = require('chai').should(), expect =…
Khrob
  • 989
  • 1
  • 10
  • 12
6
votes
4 answers

jsPDF ReferenceError: window is not defined

I need to create a PDF in Javascript. I have found the npm Package "jsPDF". I have installed "jsPDF" with npm install jspdf. It succesfully installed, but when I execute the fowolling code: const jspdf = require ('jspdf'); let doc = new…
jRyze
  • 121
  • 1
  • 5
6
votes
1 answer

Why does this code throw ReferenceError: test is not defined?

var te‌st = 1 console.log(test) Try running this simple code. It gives error: ReferenceError: test is not defined, despite the fact that I defined that variable. Why is this happening?
5
votes
1 answer

jsPDF is not defined when saving div to PDF

I'm trying to save div element with specific id using jsPDF but getting Uncaught ReferenceError: jsPDF is not defined. Tried bunch of different ways to fix this issue including all available solutions on stackoverflow and none of them worked. Here…
basilique
  • 103
  • 1
  • 6
5
votes
2 answers

ReferenceError: Can't find variable: Text (i am using expo application for react native)

this error is showing in my ios screen after downloading java script in my device. ReferenceError: Can't find variable: Text This error is located at: in App (at registerRootComponent.js:35) in RootErrorBoundary (at registerRootComponent.js:34) in…
mona alshehri
  • 71
  • 1
  • 2
5
votes
2 answers

Handlebars is not defined

I am new at JS and never tried Handlebars before. I'm trying a very bare-bones example from a tutorial. I have downloaded handlebars-v4.0.5.js from the Handlebars website and included it in my page, as follows, along with a template I precompiled,…
Steverino
  • 1,525
  • 3
  • 18
  • 34
5
votes
3 answers

Does JavaScript have the concept of l-value and r-value?

In JavaScript, if you put some kind of expression on the left side of an assignment expression, the engine will throw a ReferenceError. For example, // 'this' on the left side this = window; // ReferenceError: Invalid left-hand side in…
leslie.zhang
  • 341
  • 2
  • 12
5
votes
2 answers

uncaught ReferenceError,Calling javascript function through android application..?

I am trying to call a javascript function setGameName() through android Webview Activity but it is throwing uncaught ReferenceError:setGameName not defined at :1. My Source code is as follows: webView2.setWebChromeClient(new…
Amritpal Singh
  • 924
  • 2
  • 13
  • 33
5
votes
5 answers

ZeroClipboard just isn't working

Originally, this post was regarding my attempts to inject ZeroClipboard into web pages by and for use by my Chrome extension, but I've dumbed the scenario down and down and down in a seemingly futile attempt to identify the issue and I still can't…
1
2
3
31 32