Quas: HOW TO CHANGE OR UPDATE Variable VALUE in javascript?
Ans: To change something First write the element
Then the name and position of that element
Then write that position with equal sign Then write what you want to change.
example:
I have taken a variable which contains some names,Among these names I will change the name Rasel.Now we need to find out the index number of this Rasel,
then we can change the name with the index number. Anything can be changed by this rule.*/
var friendsName = ['habib', 'iqbal', 'shorif', 'asraful', 'rasel', 'arif', 'deader' ];
var positionIndex = friendsName.indexOf('rasel'); /* find index number */
console.log(positionIndex); /* for output index number */
/* output index number
PS C:javascript> node ans.js
4
PS C:javascript> node ans.js */
friendsName[4] = 'saiful'; /* change this index number name */
console.log(friendsName); /* for output index number */
/* output change with this name
PS C:javascript> node ans.js
[
'habib', 'iqbal',
'shorif', 'asraful',
'saiful', 'arif',
'deader'
]
PS C:javascript> */