-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshaswat.js
107 lines (66 loc) · 1.83 KB
/
shaswat.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
100
101
102
103
104
105
106
107
// let str1="Hello "
// let str2="World"
// let result1 = str1+str2
// console.log(result1)
// const { result } = require("lodash");
// let name="Saloni"
// let memory=`Hello, ${name}`
// console.log(memory)
// let str3="Hello world, I love world cup"
// console.log(str3.replace("world","Javascript"))
// console.log(str3.replace(/world/g,"Javascript"))
// function isleapyear(year){
// if((year%4==0&year%100!=0)|year%400==0){
// return "leapyear"
// }
// else{
// return "Not a leap year"
// }
// }
// let result=isleapyear(100)
// console.log(result)
// const d= new Date("2024-09-24")
// console.log(d.getDay())
// console.log(d.getMonth())
// console.log(d.getFullYear())
// console.log(d.getHours())
// console.log(d.getMinutes())
// console.log(d.getSeconds())
// console.log(d,getTime())
// function getCount(str) {
// let arr=str.split()
// let count=0;
// for(let i=0;i<arr.length;i++){
// if(arr[i]=="a"||arr[i]=="e"||arr[i]=="i"||arr[i]=="o"||arr[i]=="u"){
// ++count
// }
// }
// return count;
// }
// console.log(getCount("aaaaaa"))
//function expression----don't have function name
// const greet=function(name){
// console.log("Hii")
// console.log(name);
// return 4
// }
// result=greet("Gautam")
// console.log(result)
//function declaration
// function greet(name){
// console.log("Hii")
// console.log(name);
// return 4
// }
// result=greet("Gautam")
// console.log(result)
//we can't call a function without intialising in function expression.
// function square(a){
// return a*a
// }
// console.log(square(6))
// const greet=function(name){
// return `Hello, ${name}`
// }
const greetArrow=(name)=>`Hello, ${name}!`;
console.log(greetArrow("Saloni"))