-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPractice_set2.js.txt
54 lines (40 loc) · 1013 Bytes
/
Practice_set2.js.txt
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
/*console.log("Practice set of functions")
function add(a,b)
{
return a+b
}
let sum=add(3,3)
console.log(sum)
/*Another type of function is - anonymous function
var great= function()
{
console.log("getting call great functions ")
}
great()*/
Var keyword => variable declared with the var keyword is accessbile within throughout the function it declared
let keyword => variable declared with the let keyword is accessible within the block of function only.
*/
// JavaScript String
let day='Sunday'
console.log(day)
let spl=day.split("u")
console.log(spl)
console.log(spl.trim())
console.log(day.length())
late date='25'
let nexdate='27'
let diff=parseInt(nexdate)-parseInt(date)
console.log(diff)
// Concatenation of two string
let name="rg"+is good boy
console.log(name)
// While loop to count number of occurance of word day
let newque="today is funday"
let count=0
let val=newque.indexOf('day')
while(val==-1)
{
count ++
val=newque.indexof('day',+val+1)
}
console.log(val)