Page 15 - Web_Application_v2.0_C12_Fb
P. 15
S.No. Learning Outcomes Theory Practical
4. Create and manipulate strings using String Methods in Consider the following code:
various methods. JavaScript: var cars = ["Honda", "BMW",
Explore built-in methods for manipulating slice() "Audi", “Porsche”];
strings in JavaScript. substring() Write command in JavaScript to:
replace() add an item “Volvo “ to the array
replaceAll() cars in the last.
match() remove first element from the
toUpperCase( ) array. display number of elements
toLowerCase( ) in the array.
concat() add following array to an array
“cars”.
trim( )
charAt() var person=[“Rajan”, “Yagya”,
“Munish”];
5. Understand the array data structure in Arrays in JavaScript Consider the string “Life is
JavaScript. Creating an Array Beautiful”. Write a function
Create, initialize, and manipulate arrays. using Array Literal ‘mystring’ that performs the
Access array elements using indices. Accessing Elements of following tasks:
an Array a. Displays the length of the
Array Length string
b. Displays the string after
replacing space “ ” in the
string with “ * ”
c. Find the position of the first
occurrence of “if” and display
it.
6. Explore built-in methods for manipulating Array Methods in
arrays in JavaScript. JavaScript:
toString( )
pop( )
push( )
shift( )
unshift( )
join( )
delete( )
concat( )
slice( )
reverse( )
sort( )
7. Explore built-in mathematical methods in Math Methods in Write a function:
JavaScript. JavaScript: a. To find the value of a number
Math.round(x) raised power another number
Math.ceil(x) using Math object method.
Math.floor(x) b. To find the sqrt of a number
Math.pow(x, y) using Math object method.
Math.sqrt(x)
Math.min()
Math.max()
Math.random()
(xiii)

