Last active
April 22, 2021 09:15
-
-
Save wemakefuture/f8c760a822848d516c65815eb7e183ad to your computer and use it in GitHub Desktop.
Examples for Integromat "Run your JS" module
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
Here you can find some basic examples for the Module "Run Your JS". | |
Keep in mind that you can insert integromat variables into the textarea. |
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
function multiplyNumbers(number1, number2){ | |
var calculation = number1 * number2; | |
result = {"data": calculation}; | |
} | |
multiplyNumbers(54, 67); |
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
class Hero { | |
constructor(name, level) { | |
this.name = name; | |
this.level = level; | |
} | |
greet() { | |
return `${this.name} says hello.`; | |
} | |
} | |
class Mage extends Hero { | |
constructor(name, level, spell) { | |
super(name, level); | |
// Add a new property | |
this.spell = spell; | |
} | |
} | |
var gandalf = new Mage("Gandalf", 87, "You shall not pass!") | |
result = { | |
"name": gandalf.name, | |
"level": gandalf.level, | |
"spell": gandalf.spell, | |
"greet": gandalf.greet() | |
}; |
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 dom = new JSDOM("<!DOCTYPE html><p>Hello world</p>"); | |
result = {"innerHTML": dom.window.document.querySelector("p").textContent}; |
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 people = [ | |
{ name: "John", age: 21 }, | |
{ name: "Peter", age: 31 }, | |
{ name: "Andrew", age: 29 }, | |
{ name: "Thomas", age: 25 } | |
]; | |
const anyAdult = people.some(person => person.age >= 18); | |
let sortByAge = people.sort(function (p1, p2) { | |
return p1.age - p2.age; | |
}); | |
const john = people.find(person => person.name === 'John'); | |
result = { | |
"adultsInArray" : anyAdult, | |
"sorted": sortByAge, | |
"listAllJohnsInArray": john | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment