Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

JavaScript Using a Temporary Variable

//JavaScript program to swap two variables

//take input from the users
let a = prompt('Enter the first variable: ');
let b = prompt('Enter the second variable: ');

//create a temporary variable
let temp;

//swap variables
temp = a;
a = b;
b = temp;

console.log(`The value of a after swapping: ${a}`);
console.log(`The value of b after swapping: ${b}`);
Comment

PREVIOUS NEXT
Code Example
Javascript :: get value before change and after change js 
Javascript :: gulp delete files 
Javascript :: react native android run 
Javascript :: discordjs delete all messages in channel 
Javascript :: for each element in object 
Javascript :: what is niceScroll 
Javascript :: javascript last element in array 
Javascript :: jQuery UI Sortable, then write order into a database 
Javascript :: javascript round number to nearest 5 
Javascript :: asp.net core 3.1 convert system.string[] to javascript 
Javascript :: javascript empty cache and hard reload 
Javascript :: vuejs set 
Javascript :: find all images without alternate text 
Javascript :: iterate object keys javascript 
Javascript :: convert utc to date javascript 
Javascript :: google sign up react npm 
Javascript :: javascript regex extract url from string 
Javascript :: string contains in javascript 
Javascript :: check if a variable is a number in javascript 
Javascript :: ajax load spesific element from another page 
Javascript :: javascript format seconds into minutes and second 
Javascript :: change url with javascript after 5 seconds 
Javascript :: guid generator node 
Javascript :: react event target square brackets 
Javascript :: console.log javascript 
Javascript :: powershell json = get value by key 
Javascript :: what can i delete from create-react-app 
Javascript :: javascript date to string format 
Javascript :: jquery unbind event 
Javascript :: javascript split string only on first instance of specified character 
ADD CONTENT
Topic
Content
Source link
Name
4+5 =