JSFiddle - React, Tailwind, and code Playground

by espace3d

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/phaser/2.6.1/phaser.min.js"></script>

JavaScript

//EFFECT.JS
// in a different file for example effect.js
var e ={}

function draw_e() {
e.print_name=function(name){
console.log(name)
}

return e

}
//GAME.JS
// assuming this is my main file for example game.js
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { create: create });

var character
var utils // my external file

function create() {
character={}
character.name="teddy"

//declaring my variable who'is in a external file
utils=draw_e()

//this is what i'm looking for 
character_subfunction=function(Fonction,name){
Fonction(name)
// i have also try this :
// () => Fonction(name) 
// but that don't work 
}

character_subfunction(utils.print,character.name)
//result must be : teddy but the error is Fonction is not a function
}