Posts

Showing posts with the label function

JS-Function

 < Beginner JS >< Function >< Variable >< Loop-If >< OOP > Syntax of a function function name(){} Exemple function showAdress)_{ document.write("Hello"); } Function calling showAdress(); Function and local variables Variable declared in the body of a function ...{var custAdress}... Argument - > passing an argument This means: providing an argument to a function function circleArea(radius){ var areas; area=radius*radius*3.14; document.write("area is: ",area); } circleArea(20.75); function with more than one argument function rectangleArea(length,height){ var area; area=length*height*3.14; document.write("area: ",area); } var length,height; length=52.05; height=46.55; rectangleArea(length,height); Argument with different types function rectangleArea(length,height,shape){ ....} length=2; height=4; shape="rectangle"; rectangleArea(length,height,shape); Returning a value .... return area; } producing a value and making...

PHP-function

PHP Beginner PHP Array Loop Function Pre-Def variable Session Read Write File CRUD Advanced PHP PHP MySQL PHP MyAdmin PHP MySQL Notes Other course Python Beginner Intermediate Advanced Pro python-hosting React Links General JS PHP Programming Python C++ Stuff < Beginner PHP >< Array >< Loop >< Function >< Pre-Def variable >< Session > < Read Write File > < CRUD > < Advanced PHP > < PHP MySQL PHP MyAdmin > < PHP MySQL Notes > A function name start with letter or underscore but not...

ReactJS-Function

< React Course Notes >< ReactJS function >  Functions: const square = function(x) {   return x * x; }; console.log(square(3)); // → 9 Function`s Parameters A function can have multiple parameters  const roundTo = function(n, step) {   let remainder = n % step;   return n - remainder + (remainder < step / 2 ? 0 : step); }; console.log(roundTo(23, 10)); // → 20 or no parameters at all const makeNoise = function() {   console.log("Pling!"); }; makeNoise(); // → Pling! Nested functions const hummus = function(factor) {   const ingredient = function(amount, unit, name) {     let ingredientAmount = amount * factor;     if (ingredientAmount > 1) {       unit += "s";     }     console.log(`${ingredientAmount} ${unit} ${name}`);   };   ingredient(1, "can", "chickpeas");   ingredient(0.25, "cup", "tahini");   ingredient(0.25, "cup", "lemon juice");   ingredient(1, "...