Posted By

asimmittal on 01/31/14


Tagged


Versions (?)

JS part 1 - requireJS Tutorial


 / Published in: JavaScript
 

This is part 1 of the requireJS tutorial

  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  

You need to login to post a comment.