-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathday3.js
99 lines (79 loc) · 1.37 KB
/
day3.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/*
1) Object / OOP
2) Regular Expression
3) AJAX
*/
function Person(param1)
{
this.name = param1;
this.age = 0;
this.doSomething = ()=>{
console.log(this.name + " is doing something");
}
}
var tiki = new Person("asdfa");
tiki.name = "Tiki";
tiki.age = 47;
var miklas = new Person("asdfdfa");
miklas.name = "Miklas";
miklas.age = 25;
console.log(tiki.name);
console.log(miklas.name);
tiki.doSomething();
miklas.doSomething();
Person.prototype = {
id:''
,description:''
};
Person.prototype.goToilet = function(howManyTime)
{
console.log("Taking a dump!");
}
tiki.id = "123abc";
console.log(tiki.id);
// tiki.goToilet(0);
var sampleObj = {
prop1:""
,prop2:function(){
console.log("Test");
}
};
sampleObj.prop2();
//Regular Expressions-------------------------------------------
//Qualifiers
/*
^ Starts with
$ Ends with
[] One of
[^] Not one of
[-] Range
\ escape
\d [0-9]
\D [^0-9]
\w [A-Za-z0-9\_]
\W [^A-Za-z0-9\_]
\s [ \t\n\r]
\S [^ \t\n\r]
| Or
() group
*/
//Quantifiers
/*
* 0 or more times
+ 1 or more times
? 0 or 1 time
{n} n times
{n,} n or more times
{n,m} n to m times
*/
//var regexp = new RegExp("^\w\d\.jpg$");
var regexp = /^(0[1-9]|[12]\d|3[01])(0[1-9]|1[0-2])\d{2}[\-A]\d{3}[A-Z0-9]$/;
var testStr = "220793-152A";
if(regexp.test(testStr))
{
console.log("TRUE");
}
else
{
console.log("FALSE");
}