screen_rotation
Copied to Clipboard
<!DOCTYPE html> <html> <head> <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script> </head> <body> <div id="app"> <h3>Vue Js Convert Array to Set</h3> <p>Original Array :{{ array }}</p> <p>Converted Array :{{ setArray }}</p> </div> <script> const app = new Vue({ el: "#app", data() { return { array: [1, 2, 3, 4, 4, 5, 5], setArray: [], }; }, mounted() { this.convertArrayToSet(); }, methods: { convertArrayToSet() { this.setArray = Array.from(new Set(this.array)); }, }, }); </script> </body> </html>