From 7d13d001eeff70a1bddcb52997d788b61014c28c Mon Sep 17 00:00:00 2001 From: Adwaith Date: Tue, 22 Jan 2019 19:19:38 +0530 Subject: [PATCH] Update Data Reference Examples on p5js.org to ES6 --- src/data/p5.TypedDict.js | 50 ++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/src/data/p5.TypedDict.js b/src/data/p5.TypedDict.js index 1afc2a28ae..40d9cf1aaf 100644 --- a/src/data/p5.TypedDict.js +++ b/src/data/p5.TypedDict.js @@ -28,10 +28,10 @@ var p5 = require('../core/main'); *
* * function setup() { - * var myDictionary = createStringDict('p5', 'js'); + * let myDictionary = createStringDict('p5', 'js'); * print(myDictionary.hasKey('p5')); // logs true to console * - * var anotherDictionary = createStringDict({ happy: 'coding' }); + * let anotherDictionary = createStringDict({ happy: 'coding' }); * print(anotherDictionary.hasKey('happy')); // logs true to console * } *
@@ -62,10 +62,10 @@ p5.prototype.createStringDict = function(key, value) { *
* * function setup() { - * var myDictionary = createNumberDict(100, 42); + * let myDictionary = createNumberDict(100, 42); * print(myDictionary.hasKey(100)); // logs true to console * - * var anotherDictionary = createNumberDict({ 200: 84 }); + * let anotherDictionary = createNumberDict({ 200: 84 }); * print(anotherDictionary.hasKey(200)); // logs true to console * } *
@@ -110,7 +110,7 @@ p5.TypedDict = function(key, value) { *
* * function setup() { - * var myDictionary = createNumberDict(1, 10); + * let myDictionary = createNumberDict(1, 10); * myDictionary.create(2, 20); * myDictionary.create(3, 30); * print(myDictionary.size()); // logs 3 to the console @@ -134,7 +134,7 @@ p5.TypedDict.prototype.size = function() { *
* * function setup() { - * var myDictionary = createStringDict('p5', 'js'); + * let myDictionary = createStringDict('p5', 'js'); * print(myDictionary.hasKey('p5')); // logs true to console * } *
@@ -156,8 +156,8 @@ p5.TypedDict.prototype.hasKey = function(key) { *
* * function setup() { - * var myDictionary = createStringDict('p5', 'js'); - * var myValue = myDictionary.get('p5'); + * let myDictionary = createStringDict('p5', 'js'); + * let myValue = myDictionary.get('p5'); * print(myValue === 'js'); // logs true to console * } *
@@ -184,7 +184,7 @@ p5.TypedDict.prototype.get = function(key) { *
* * function setup() { - * var myDictionary = createStringDict('p5', 'js'); + * let myDictionary = createStringDict('p5', 'js'); * myDictionary.set('p5', 'JS'); * myDictionary.print(); // logs "key: p5 - value: JS" to console * } @@ -222,7 +222,7 @@ p5.TypedDict.prototype._addObj = function(obj) { *
* * function setup() { - * var myDictionary = createStringDict('p5', 'js'); + * let myDictionary = createStringDict('p5', 'js'); * myDictionary.create('happy', 'coding'); * myDictionary.print(); * // above logs "key: p5 - value: js, key: happy - value: coding" to console @@ -255,7 +255,7 @@ p5.TypedDict.prototype.create = function(key, value) { *
* * function setup() { - * var myDictionary = createStringDict('p5', 'js'); + * let myDictionary = createStringDict('p5', 'js'); * print(myDictionary.hasKey('p5')); // prints 'true' * myDictionary.clear(); * print(myDictionary.hasKey('p5')); // prints 'false' @@ -278,7 +278,7 @@ p5.TypedDict.prototype.clear = function() { *
* * function setup() { - * var myDictionary = createStringDict('p5', 'js'); + * let myDictionary = createStringDict('p5', 'js'); * myDictionary.create('happy', 'coding'); * myDictionary.print(); * // above logs "key: p5 - value: js, key: happy - value: coding" to console @@ -307,7 +307,7 @@ p5.TypedDict.prototype.remove = function(key) { *
* * function setup() { - * var myDictionary = createStringDict('p5', 'js'); + * let myDictionary = createStringDict('p5', 'js'); * myDictionary.create('happy', 'coding'); * myDictionary.print(); * // above logs "key: p5 - value: js, key: happy - value: coding" to console @@ -454,7 +454,7 @@ p5.NumberDict.prototype._validate = function(value) { *
* * function setup() { - * var myDictionary = createNumberDict(2, 5); + * let myDictionary = createNumberDict(2, 5); * myDictionary.add(2, 2); * print(myDictionary.get(2)); // logs 7 to console. * } @@ -482,7 +482,7 @@ p5.NumberDict.prototype.add = function(key, amount) { *
* * function setup() { - * var myDictionary = createNumberDict(2, 5); + * let myDictionary = createNumberDict(2, 5); * myDictionary.sub(2, 2); * print(myDictionary.get(2)); // logs 3 to console. * } @@ -506,7 +506,7 @@ p5.NumberDict.prototype.sub = function(key, amount) { *
* * function setup() { - * var myDictionary = createNumberDict(2, 4); + * let myDictionary = createNumberDict(2, 4); * myDictionary.mult(2, 2); * print(myDictionary.get(2)); // logs 8 to console. * } @@ -534,7 +534,7 @@ p5.NumberDict.prototype.mult = function(key, amount) { *
* * function setup() { - * var myDictionary = createNumberDict(2, 8); + * let myDictionary = createNumberDict(2, 8); * myDictionary.div(2, 2); * print(myDictionary.get(2)); // logs 4 to console. * } @@ -585,8 +585,8 @@ p5.NumberDict.prototype._valueTest = function(flip) { *
* * function setup() { - * var myDictionary = createNumberDict({ 2: -10, 4: 0.65, 1.2: 3 }); - * var lowestValue = myDictionary.minValue(); // value is -10 + * let myDictionary = createNumberDict({ 2: -10, 4: 0.65, 1.2: 3 }); + * let lowestValue = myDictionary.minValue(); // value is -10 * print(lowestValue); * } *
@@ -606,8 +606,8 @@ p5.NumberDict.prototype.minValue = function() { *
* * function setup() { - * var myDictionary = createNumberDict({ 2: -10, 4: 0.65, 1.2: 3 }); - * var highestValue = myDictionary.maxValue(); // value is 3 + * let myDictionary = createNumberDict({ 2: -10, 4: 0.65, 1.2: 3 }); + * let highestValue = myDictionary.maxValue(); // value is 3 * print(highestValue); * } *
@@ -650,8 +650,8 @@ p5.NumberDict.prototype._keyTest = function(flip) { *
* * function setup() { - * var myDictionary = createNumberDict({ 2: 4, 4: 6, 1.2: 3 }); - * var lowestKey = myDictionary.minKey(); // value is 1.2 + * let myDictionary = createNumberDict({ 2: 4, 4: 6, 1.2: 3 }); + * let lowestKey = myDictionary.minKey(); // value is 1.2 * print(lowestKey); * } *
@@ -671,8 +671,8 @@ p5.NumberDict.prototype.minKey = function() { *
* * function setup() { - * var myDictionary = createNumberDict({ 2: 4, 4: 6, 1.2: 3 }); - * var highestKey = myDictionary.maxKey(); // value is 4 + * let myDictionary = createNumberDict({ 2: 4, 4: 6, 1.2: 3 }); + * let highestKey = myDictionary.maxKey(); // value is 4 * print(highestKey); * } *