As it is my first task, instead of doing directly in the Online Editor, I am doing it in my Visual Studio Code Editor. Below are my .js file, and .html file.
From the below javascript code, sym([1, 2, 3], [5, 2, 1, 4]);
is showing alert for 1,2, and 3 only. But, I thought that, this code will show two alerts as there are two arrays inside the argument.
I want args
to accept my two arrays as two different items. How can I modify the code to achieve this requirement?
function sym(args) {
args.forEach(element => {
alert(element);
});
return args;
}
sym([1, 2, 3], [5, 2, 1, 4]);
Below is my .html file
<html>
<head>
<script src="Test.js"></script>
</head>
<body>
<button id="Button1" onclick="Sym();">
Click!
</button>
</body>
</html>
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:77.0) Gecko/20100101 Firefox/77.0
.
Challenge: Find the Symmetric Difference
Link to the challenge: