Skip to content

Instantly share code, notes, and snippets.

@wemakefuture
Last active April 22, 2021 09:15
Show Gist options
  • Save wemakefuture/f8c760a822848d516c65815eb7e183ad to your computer and use it in GitHub Desktop.
Save wemakefuture/f8c760a822848d516c65815eb7e183ad to your computer and use it in GitHub Desktop.
Examples for Integromat "Run your JS" module
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.
function multiplyNumbers(number1, number2){
var calculation = number1 * number2;
result = {"data": calculation};
}
multiplyNumbers(54, 67);
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()
};
const dom = new JSDOM("<!DOCTYPE html><p>Hello world</p>");
result = {"innerHTML": dom.window.document.querySelector("p").textContent};
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