Search the Community

Showing results for tags 'fp'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Coding and Game Design
  • Frameworks
    • Phaser
    • Pixi.js
    • Babylon.js
    • Panda.js
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Found 1 result

  1. hi, i'm happy to play now with short code and modularize them together. What saves time and readability ! But in this case i don't see what it's possible to do with the function foreach. Is it possible to use foreach like this config with a trick in the hide_weapon_internal ? //normal function who works if(dalle_moving[0]){ for (var j = 0; j < dalle_moving.length; j++){ dalle_moving[j].hide() } } //////////////////////////////////////////////////////////////////////////////////// //NOW WITH FUNCTIONAL PROGRAMATION function is_exist(obj){ if(typeof obj != "undefined"){ return true; }else{ return false; } } function foreach(table,action){ for(var i=0;i<table.length;i++){ action(table[i]); } } ////////////////////////////////////////// var hide_enemy=function(obj){ is_exist(obj[0]) && foreach(obj,obj.hide) } hide_enemy(dalle_moving) ////////////////////////////////////////// //obj.hide don't works because i must say action(obj[i].hide()) //is there a trick to do that with the function foreach as she is ? i have the feeling that 's possible ....no?