runkit example
Closed this issue · 1 comments
slowkow commented
I tried to run an example at
but I don't know the correct syntax. Could you help me figure out how to fix this so it runs?
Here's the code I'm trying to run:
var avl = require("avl");
const t = new avl.AVLTree();
t.insert(5);
t.insert(-10);
t.insert(0);
t.insert(33);
t.insert(2);
console.log(t.keys()); // [-10, 0, 2, 5, 33]
console.log(t.size); // 5
console.log(t.min()); // -10
console.log(t.max()); // -33
t.remove(0);
console.log(t.size); // 4
I get:
TypeError: avl.AVLTree is not a constructor
in this notebook — line 3
w8r commented
var AVL = require("avl")
const t = new AVL();
t.insert(5);
t.insert(-10);
t.insert(0);
t.insert(33);
t.insert(2);
console.log(t.keys()); // [-10, 0, 2, 5, 33]
console.log(t.size); // 5
console.log(t.min()); // -10
console.log(t.max()); // -33
t.remove(0);
console.log(t.size);