forked from rohan-paul/Awesome-JavaScript-Interviews
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-code.js
More file actions
52 lines (43 loc) · 1.16 KB
/
Copy pathtest-code.js
File metadata and controls
52 lines (43 loc) · 1.16 KB
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
// function phonenumber(inputtxt) {
// var phoneno = /^(?:(?:\+|0{0,2})91(\s*[\-]\s*)?|[0]?)?[789]\d{9}$/;
// if (inputtxt.match(phoneno)) {
// return true;
// } else {
// return false;
// }
//
validateIndianMobilenumber = inputtxt => {
var phoneno = new RegExp(
"(?:(?:\\+|0{0,2})91(\\s*[\\- ]\\s*)?|[0 ]?)?[789]\\d{9}|(\\d[ -]?){10}\\d",
"g"
);
if (inputtxt.match(phoneno)) {
return true;
} else {
return false;
}
};
// console.log(phonenumber("9051171133"));
const str1 = "2";
const str2 = "3";
// console.log(str1 + str2);
finalOTPFromMultipleFields = (s1, s2, s3, s4) => {
console.log(arguments);
return s1 + s2 + s3 + s4;
};
console.log(finalOTPFromMultipleFields("2", "3", "4", "5"));
testArguments = () => {
// <-- notice no arguments specified
console.log(arguments); // outputs the arguments to the console
var htmlOutput = "";
for (var i = 0; i < arguments.length; i++) {
htmlOutput += arguments[i];
}
return htmlOutput;
};
// testArguments("This", "is", "a", "test");
var displayIt = function() {
return "the list: " + Array.prototype.join.call(arguments, ",");
};
// console.log(displayIt(str1, str2));
// finalOTPFromMultipleFields;