As a fervent Python enthusiast, I have a strong distaste for JavaScript's lack of elegance.
Fortunately, I have found a solution to adapt it to my liking.
import { createApp } from 'vue'
import App from './App.vue'
var array_len_plugin = {
install()
{
Array.prototype.len = function () { return this.length }
}
}
var app = createApp( App )
app.use( array_len_plugin )
app.mount( '#app' )
However, this solution does not work as expected by default.
Array.prototype.len = Array.prototype.length
How can I make this modification function properly?