JS part 1 - requireJS Tutorial


/ Published in: JavaScript
Save to your folder(s)

This is part 1 of the requireJS tutorial


Copy this code and paste it in your HTML
  1. define([],function(){
  2. var pool = ['a','b','c','d'];
  3. var Random = function(){
  4.  
  5. this.getRandomString = function(N){
  6. var strToReturn = "";
  7. for(var i = 0; i < N; i++){
  8. var indexToPick = Math.floor((Math.random()*pool.length));
  9. strToReturn += pool[indexToPick];
  10. }
  11.  
  12. return strToReturn;
  13. };
  14. };
  15.  
  16.  
  17. return Random;
  18. });

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.