Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

Calculating with Functions

function ex(x,value) {
    return typeof x === 'function' ? x(value) : value

}
 
function zero(x) {
    const value = 0

    return ex(x,value)
}
function one(x) {
    const value = 1

    return ex(x,value)
}

function two(x) {
    const value = 2

    return ex(x,value)
}

function three(x) {
    const value = 3

    return ex(x,value)
}
function four(x) {
    const value = 4

    return ex(x,value)

}
function five(x) {
    const value = 5

    return ex(x,value)
}
function six(x) {
    const value = 6

    return ex(x,value)
}
function seven(x) {

    const value = 7

    return ex(x,value)

}
function eight(x) {
    const value = 8

    return ex(x,value)
}
function nine(x) {
    const value = 9

    return ex(x,value)
}

function plus(x) {
    return (y) => {
        return x + y
    }

}
function minus(x) {
    return (y) => {

      return y-x
    }


}
function times(x) {
    return (y) => {
       return x * y
    }


}
function dividedBy(x) { 
    return (y)=>{
      return Math.floor(y/x)
    }
}

console.log(two(dividedBy(six())))



Comment

PREVIOUS NEXT
Code Example
Javascript :: leetcode solution problem 66 plus one 
Javascript :: var sumArray = function(arr) {}; 
Javascript :: How to Loop Through an Array with a forEach Loop in JavaScript 
Javascript :: javascript enter key 
Javascript :: geteliment by id in javascript 
Javascript :: react : calling APIs after render w error message 
Javascript :: Backbone Error: Uncaught TypeError: this.set is not a function 
Javascript :: how to render react quill the way it is without the html tags 
Javascript :: Using Fetched Data With Backbone 
Javascript :: clear an array 
Javascript :: how to convert javascript to typescript 
Javascript :: How to fix prettier messing up your HTML on save 
Javascript :: javascript odd or even 
Javascript :: password generator javascript 
Javascript :: promise object 
Javascript :: new react 
Javascript :: && condition in javascript 
Javascript :: ~~ in js 
Javascript :: regex javscript 
Javascript :: socket io server 
Javascript :: babel core cdn 
Javascript :: EFSavechanges 
Javascript :: javascript declare variables 
Javascript :: javascript + Operator with Numbers 
Javascript :: javascript setTimeout() method returns the interval id 
Javascript :: ajax introduction 
Javascript :: dropzone sending event add additional data 
Javascript :: manter alguns campos objetos javascript 
Javascript :: link change page react 
Javascript :: phaser reverse animation 
ADD CONTENT
Topic
Content
Source link
Name
7+4 =