I'm currently working on a little project which use pug (I discovered it just yesterday).
Here is my configuration:
file1.pug
- let resultArray = oldArray;
input(
type='button'
name='resultButton'
placeholder='Click me...'
onclick="addNumber(resultArray)"
)
script
include scripts/search_script.js
externalScript.js
function getTotal(resultArray) {
let result = 0;
let newArray = [];
for(let i = 0; i < resultArray.length; i++){
result += resultArray[i];
}
newArray.push(result);
return newArray;
}
It's just a little (weird) example of what I did.
The thing is, I was wondering if the value of resultArray which is in my file1.pug can be replaced by the value returned from the method getTotal() in my externalScript.js?