screen_rotation
Copied to Clipboard
<html> <head> <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script> </head> <body> <div id="app"> <h3>Determining Array Equality in Vue.js with JSON.stringify()"</h3> <p>Result: {{result}}</p> </div> <script type="module"> const app = new Vue({ el: "#app", data() { return { arr1: ['a', 'b', 'c'], arr2: ['c', 'b', 'a'], result: null } }, mounted() { if (JSON.stringify(this.arr1.sort()) === JSON.stringify(this.arr2.sort())) { this.result = 'Array are equal' } else { this.result = "Arrays are not equal"; } } }); </script> </body> </html>