forked from rmurphey/js-assessment
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbestPractices.js
36 lines (32 loc) · 879 Bytes
/
bestPractices.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
if (typeof define !== 'function') { var define = require('amdefine')(module); }
/**
* This file defines an object with some methods. Some of these methods are
* populated incorrectly; your job is to fix them. Other methods are not
* populated at all; your job is to fill them out.
*/
define(function() {
return {
globals : function() {
var myObject = {
name : 'Jory'
};
return myObject;
},
functions : function(flag) {
// return(function(){
if(flag){ return 'a';}
else {return 'b';}
// })();
},
parseInt : function(num) {
var r=new RegExp(/^\d{1,}/);
num=num.match(r);
return parseInt(num,10);
},
identity : function(val1, val2) {
if(val1+val2=='11') return false;
if(val1+val2==2) return true;
if (val1+val2==0) return false;
}
};
});