p5.js-website icon indicating copy to clipboard operation
p5.js-website copied to clipboard

Missing example in function reference

Open ankur0904 opened this issue 2 years ago • 3 comments

Increasing Access

Unsure

Most appropriate sub-area of p5.js?

Reference

Feature request details

Adding an example to the following code here

let square = number => number * number;
console.log(square(5));

will help in the following ways

  • Maintain consistency with the previous code snippets previous example code snippet
            let myName = 'Hridi';
            function sayHello(name) {
              console.log('Hello ' + name + '!');
            }
            sayHello(myName); // calling the function, prints "Hello Hridi!" to console.
    
  • give a good understanding to the user who is reading the reference i.e., what the code is doing.

My suggestions (suggested change)

let square = number => number * number;
console.log(square(5)); // calling the function and printing in console, prints "25" to console.  

ankur0904 avatar Dec 16 '23 07:12 ankur0904