Click here to Skip to main content
15,868,016 members
Home / Discussions / JavaScript
   

JavaScript

 
GeneralRe: AddEventListener in vanilla Javascript Pin
jkirkerx21-Jun-21 6:58
professionaljkirkerx21-Jun-21 6:58 
Questionhow to limit the draggable area in snap.svg? Pin
Member 1269897212-Jun-21 20:45
Member 1269897212-Jun-21 20:45 
QuestionI am getting the following error while trying to run ./watch for my Ember JS application Pin
simpledeveloper1-Jun-21 19:44
simpledeveloper1-Jun-21 19:44 
AnswerRe: I am getting the following error while trying to run ./watch for my Ember JS application Pin
jkirkerx16-Jun-21 14:58
professionaljkirkerx16-Jun-21 14:58 
QuestionHow To Use Dynamic variable in Javascript Pin
pranay kumar 202127-May-21 3:14
pranay kumar 202127-May-21 3:14 
AnswerRe: How To Use Dynamic variable in Javascript Pin
jkirkerx16-Jun-21 15:01
professionaljkirkerx16-Jun-21 15:01 
QuestionHow to deskew a page of pdf document which is loaded through pdf.js Pin
Member 1520321817-May-21 8:58
Member 1520321817-May-21 8:58 
QuestionJavascript Array Wrapper or Class Pin
Member 1510027612-May-21 14:23
Member 1510027612-May-21 14:23 
I need a Wrapper or a Class that can control the Max Length of an Array on setting a value... It might be possible with a Prototype too, which is fine...

JavaScript
let myArray = new ArrayClassThing();

myArray.setMax = 50; // should be a const value set in Constructor or Prototype

myArray[50] = "Foo";  // This should work fine, I know index starts at 0, but I am not using 0 so total of 50
myArray[51] = "Bar";  // Need to do nothing


Javascript is different than Ruby where you can use special characters to define Getter and Setter methods:

Ruby
# Ruby Code
class Array_Wrapper
  def initialize
    @data = []
  end
  # Getter
  def [](id)
    if id <= 50 and @data[id]
      return @data[id]
    end
  end
  # Setter
  def []=(id,value)
    if id <= 50
      @data[id] = value
    end
  end


As far as I understand, cant use a "[]" as a Getter or Setter Method, and I need something that can do exactly that, just to control a Static Maximum, like in the first code block... Perhaps a better question to ask is how to define Getter and Setter Method WITHOUT A PROXY (which I KNOW is damn well good and possible) of a Class Prototype, but from inside the constructor (which I also know is syntactical sugar)...

Can anyone help out with this?
QuestionUse of assignment operator inside {} Pin
captain prime30-Apr-21 1:40
captain prime30-Apr-21 1:40 
AnswerRe: Use of assignment operator inside {} Pin
Richard Deeming30-Apr-21 1:49
mveRichard Deeming30-Apr-21 1:49 
GeneralRe: Use of assignment operator inside {} Pin
captain prime30-Apr-21 18:23
captain prime30-Apr-21 18:23 
QuestionMulti select with Id:Value init issue - Tabulator.js (Oli Folkerd) Pin
Member 105369227-Apr-21 23:38
Member 105369227-Apr-21 23:38 
QuestionNode express.js API slow response on first time request Pin
Member 1395114022-Apr-21 1:36
Member 1395114022-Apr-21 1:36 
QuestionHelp Pin
fielle14-Apr-21 22:17
fielle14-Apr-21 22:17 
AnswerRe: Help Pin
Richard Deeming14-Apr-21 22:51
mveRichard Deeming14-Apr-21 22:51 
Question8yr JS now giving me console error in FF and CHROME Pin
Member 1514660811-Apr-21 9:07
Member 1514660811-Apr-21 9:07 
AnswerRe: 8yr JS now giving me console error in FF and CHROME Pin
Richard Deeming11-Apr-21 21:29
mveRichard Deeming11-Apr-21 21:29 
GeneralRe: 8yr JS now giving me console error in FF and CHROME Pin
Member 1514660812-Apr-21 3:00
Member 1514660812-Apr-21 3:00 
GeneralRe: 8yr JS now giving me console error in FF and CHROME Pin
Richard Deeming12-Apr-21 3:09
mveRichard Deeming12-Apr-21 3:09 
GeneralRe: 8yr JS now giving me console error in FF and CHROME Pin
Member 1514660812-Apr-21 3:14
Member 1514660812-Apr-21 3:14 
GeneralRe: 8yr JS now giving me console error in FF and CHROME Pin
Richard Deeming12-Apr-21 3:39
mveRichard Deeming12-Apr-21 3:39 
GeneralRe: 8yr JS now giving me console error in FF and CHROME Pin
Member 1514660812-Apr-21 4:00
Member 1514660812-Apr-21 4:00 
QuestionKendo UI for jQuery Combobox noDataTemplate Not Loading Pin
Hypermommy5-Apr-21 9:35
Hypermommy5-Apr-21 9:35 
Questionquirks with use of Audio() Pin
Derell Licht31-Mar-21 16:03
professionalDerell Licht31-Mar-21 16:03 
QuestionBizarre JSON parse problem Pin
intoittendenz28-Mar-21 23:27
intoittendenz28-Mar-21 23:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.