This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function multiplicacao($multiplicador,$multiplicando,$count) | |
{ | |
if ($count >= 1 ) | |
{ | |
echo " $multiplicador x $multiplicando = " . $multiplicador * $multiplicando . "<br>"; | |
return $multiplicador * multiplicacao($multiplicador,$multiplicador*$multiplicando,--$count); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const produtos = [ | |
{ | |
nome: 'Bicicleta', | |
preco: 1200.0 | |
}, | |
{ | |
nome: 'Capacete', | |
preco: 450.0 | |
} | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const produtos = [ | |
{ | |
id: 1, | |
preco: 10.0, | |
qtd: 2 | |
}, | |
{ | |
id: 2, | |
preco: 10.0, | |
qtd: 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs') | |
const path = './' | |
const readdirPromise = (path) => { | |
return new Promise( ( resolve, reject ) => { | |
fs.readdir( path, ( err, files) => { | |
if( err ) { | |
console.log('ocorreu um erro') | |
}else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs') | |
const path = './' | |
const readdirPromise = (path) => { | |
return new Promise( ( resolve, reject ) => { | |
fs.readdir( path, ( err, files) => { | |
if ( err ) { | |
reject( err ) | |
}else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express') | |
const app = express() | |
const port = 3000 | |
app.get('/somar', (req, res) =>{ | |
const sum = parseInt(req.query.num1) + parseInt(req.query.num2) | |
res.send('A soma é: ' + sum) | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const inverse = ( x ) => x *- 1 | |
const add = ( y ) => ( x ) => x + y | |
const substract = ( y ) => ( x ) => add( inverse( y ) )( x ) | |
const divide = ( y ) => ( x ) => { | |
let result = 0; | |
const subX = substract( x ) | |
const add1 = add(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const add = ( x ) => ( y ) => x + y | |
const divide = ( x ) => ( y ) => { | |
let multiplyfor10 = 0; | |
const multiply10 = add(10) | |
const decrement1 = add(-1) | |
const addFinal = add(0.1) | |
const decrementY = add(-y) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const inverse = ( x ) => x *- 1 | |
const add = ( y ) => ( x ) => x + y | |
const substract = ( y ) => ( x ) => add( inverse( y ) )( x ) | |
const root = ( y ) => ( x ) => Math.pow( x , 1/y) | |
const squareRoot = root( 2 ) | |
const multiply = ( y ) => ( x ) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const pow = ( y ) => ( x ) => Math.pow( x, y ) | |
const square = pow(2) | |
const isGreatThan = ( y ) => ( x ) => x > y | |
const isGreatThan20 = isGreatThan(20) | |
const RadicandoGreatThan20 = ( value ) => isGreatThan20( square( value ) ) | |
const list = [1,2,3,4,5,6,7,8,9,10] |
OlderNewer