KW Online Tools Zone
Knowledge Walls
View All Tools Home
HOW TO USE CALL BY VALUE IN JAVASCRIPT FUNCTIONS WITH EXAMPLE
[Javascript editor]
Run
Share Link
Clear
HTML [Ctrl+Enter] - to run
How to use call by value in Javascript functions with Example
Values are not swaped in this eample because it is call by value
CSS [Ctrl+Enter] - to run
Javascript [Ctrl+Enter] - to run
function swap(num1,num2){ num = num1; num1 = num2; num2 = num; } var num1 = 12; var num2 = 24; document.write(num1+" - "+num2+"
"); swap(num1,num2); document.write(num1+" - "+num2+"
");
OUTPUT
Copyright © 2021 Knowledge walls, All rights reserved
Copyright © 2021 Knowledge walls, All rights reserved