Skip to content

Commit 3164ce2

Browse files
From let to const
Converted all let to const wherever possible.
1 parent 511986a commit 3164ce2

15 files changed

+45
-45
lines changed

src/data/examples/en/16_Dom/03_Input_Button.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function setup() {
2626
}
2727

2828
function greet() {
29-
let name = input.value();
29+
const name = input.value();
3030
greeting.html('hello ' + name + '!');
3131
input.value('');
3232

src/data/examples/en/16_Dom/04_Slider.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ function setup() {
2323
}
2424

2525
function draw() {
26-
let r = rSlider.value();
27-
let g = gSlider.value();
28-
let b = bSlider.value();
26+
const r = rSlider.value();
27+
const g = gSlider.value();
28+
const b = bSlider.value();
2929
background(r, g, b);
3030
text('red', rSlider.x * 2 + rSlider.width, 35);
3131
text('green', gSlider.x * 2 + gSlider.width, 65);

src/data/examples/en/16_Dom/07_Modify_DOM.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ function setup() {
3333
// This line grabs the paragraph just created, but it would
3434
// also grab any other elements with class 'text' in the HTML
3535
// page.
36-
let texts = selectAll('.text');
36+
const texts = selectAll('.text');
3737

3838
for (let i = 0; i < texts.length; i++) {
39-
let paragraph = texts[i].html();
40-
let words = paragraph.split(' ');
39+
const paragraph = texts[i].html();
40+
const words = paragraph.split(' ');
4141
for (let j = 0; j < words.length; j++) {
42-
let spannedWord = createSpan(words[j]);
43-
let dw = new DanceSpan(spannedWord, random(600), random(200));
42+
const spannedWord = createSpan(words[j]);
43+
const dw = new DanceSpan(spannedWord, random(600), random(200));
4444
dancingWords.push(dw);
4545
}
4646
}

src/data/examples/en/16_Dom/10_Video_Pixels.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ function setup() {
2121
function draw() {
2222
background(255);
2323
fingers.loadPixels();
24-
let stepSize = round(constrain(mouseX / 8, 6, 32));
24+
const stepSize = round(constrain(mouseX / 8, 6, 32));
2525
for (let y = 0; y < height; y += stepSize) {
2626
for (let x = 0; x < width; x += stepSize) {
27-
let i = y * width + x;
28-
let darkness = (255 - fingers.pixels[i * 4]) / 255;
29-
let radius = stepSize * darkness;
27+
const i = y * width + x;
28+
const darkness = (255 - fingers.pixels[i * 4]) / 255;
29+
const radius = stepSize * darkness;
3030
ellipse(x, y, radius, radius);
3131
}
3232
}

src/data/examples/en/16_Dom/12_Drop.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
function setup() {
1010
// create canvas
11-
let c = createCanvas(710, 400);
11+
const c = createCanvas(710, 400);
1212
background(100);
1313
// Add an event for when a file is dropped onto the canvas
1414
c.drop(gotFile);
@@ -27,7 +27,7 @@ function gotFile(file) {
2727
// If it's an image file
2828
if (file.type === 'image') {
2929
// Create an image DOM element but don't show it
30-
let img = createImg(file.data).hide();
30+
const img = createImg(file.data).hide();
3131
// Draw the image onto the canvas
3232
image(img, 0, 0, width, height);
3333
} else {

src/data/examples/es/16_Dom/03_Input_Button.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function setup() {
2626
}
2727

2828
function greet() {
29-
let name = input.value();
29+
const name = input.value();
3030
greeting.html('hello ' + name + '!');
3131
input.value('');
3232

src/data/examples/es/16_Dom/04_Slider.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ function setup() {
2323
}
2424

2525
function draw() {
26-
let r = rSlider.value();
27-
let g = gSlider.value();
28-
let b = bSlider.value();
26+
const r = rSlider.value();
27+
const g = gSlider.value();
28+
const b = bSlider.value();
2929
background(r, g, b);
3030
text('red', 165, 35);
3131
text('green', 165, 65);

src/data/examples/es/16_Dom/07_Modify_DOM.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ function setup() {
3131

3232
// Esta línea toma el párrafo recién creado, pero podría también
3333
// tomar otros elementos de la clase 'text' en la página HTML.
34-
let texts = selectAll('.text');
34+
const texts = selectAll('.text');
3535

3636
for (let i = 0; i < texts.length; i++) {
37-
let paragraph = texts[i].html();
38-
let words = paragraph.split(' ');
37+
const paragraph = texts[i].html();
38+
const words = paragraph.split(' ');
3939
for (let j = 0; j < words.length; j++) {
40-
let spannedWord = createSpan(words[j]);
41-
let dw = new DanceSpan(spannedWord, random(600), random(200));
40+
const spannedWord = createSpan(words[j]);
41+
const dw = new DanceSpan(spannedWord, random(600), random(200));
4242
dancingWords.push(dw);
4343
}
4444
}

src/data/examples/es/16_Dom/10_Video_Pixels.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ function setup() {
2121
function draw() {
2222
background(255);
2323
fingers.loadPixels();
24-
let stepSize = round(constrain(mouseX / 8, 6, 32));
24+
const stepSize = round(constrain(mouseX / 8, 6, 32));
2525
for (let y = 0; y < height; y += stepSize) {
2626
for (let x = 0; x < width; x += stepSize) {
27-
let i = y * width + x;
28-
let darkness = (255 - fingers.pixels[i * 4]) / 255;
29-
let radius = stepSize * darkness;
27+
const i = y * width + x;
28+
const darkness = (255 - fingers.pixels[i * 4]) / 255;
29+
const radius = stepSize * darkness;
3030
ellipse(x, y, radius, radius);
3131
}
3232
}

src/data/examples/es/16_Dom/12_Drop.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
function setup() {
1010
// crear el lienzo
11-
let c = createCanvas(710, 400);
11+
const c = createCanvas(710, 400);
1212
background(100);
1313
// añadir un evento para cuando un archivo sea arrojado al lienzo
1414
c.drop(gotFile);
@@ -27,7 +27,7 @@ function gotFile(file) {
2727
// si es un archivo de imagen
2828
if (file.type === 'image') {
2929
// crear un elemento de imagen DOM, pero sin mostrarlo
30-
let img = createImg(file.data).hide();
30+
const img = createImg(file.data).hide();
3131
// dibujar la imagen en el lienzo
3232
image(img, 0, 0, width, height);
3333
} else {

0 commit comments

Comments
 (0)