8Observer8 Posted September 28, 2016 Share Posted September 28, 2016 Hello Please, help me to understand what does mean '_' in this JavaScript code. I took this pease of code from here function createPoints(spawnBehavior) { var ret = new THREE.Geometry(); _.times(mode.particleCount, function (index) { ret.vertices.push(spawnBehavior(index)); }) return ret; } Quote Link to comment Share on other sites More sharing options...
benny! Posted September 28, 2016 Share Posted September 28, 2016 http://underscorejs.org/#times Quote Link to comment Share on other sites More sharing options...
8Observer8 Posted September 28, 2016 Author Share Posted September 28, 2016 Thank you very much Quote Link to comment Share on other sites More sharing options...
alex_h Posted October 2, 2016 Share Posted October 2, 2016 Could also be lodash https://lodash.com/ http://stackoverflow.com/questions/13789618/differences-between-lodash-and-underscore Quote Link to comment Share on other sites More sharing options...
8Observer8 Posted October 2, 2016 Author Share Posted October 2, 2016 Thank you! I found all libs from this example: <script src='https://cdnjs.cloudflare.com/ajax/libs/three.js/r77/three.min.js'></script> <script src='http://cdnjs.cloudflare.com/ajax/libs/lodash.js/3.5.0/lodash.min.js'></script> <script src='http://cdn.rawgit.com/antishow/animation-controller/master/animation-controller.js'></script> <script src='https://cdn.rawgit.com/mrdoob/three.js/master/examples/js/controls/OrbitControls.js'></script> <script src="js/three.min.js"></script> <script src="js/underscore-min.js"></script> <script src="js/animation-controller.js"></script> <script src="js/controls/OrbitControls2.js"></script> <script src="js/lodash.min.js"></script> Snowstorm.zip Quote Link to comment Share on other sites More sharing options...
mattstyles Posted October 2, 2016 Share Posted October 2, 2016 It could actually be anything, JS variable assignment being what it is. _ just references an object, by convention, this has been 'claimed' by underscore, and then lodash, but also used by some functional libraries too (in the same way jQuery has claimed $), there's no formal claiming here, they just assign their libraries to this identifier, if you included two libraries that try to assign to the same identifier (such as underscore and lodash, not that you'd ever want to) then they'll clash and only one will get the reference. As you've dug through the includes and found lodash, its pretty safe to assume that it refers to that library. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.