What & why?
MetaES is a building block for other libraries and tools.
It was created to speed up applications development.
JavaScript in JavaScript interpreter.
MetaES is a building block for other libraries and tools.
It was created to speed up applications development.
MetaES is a metacircular interpreter. It means it's written JavaScript.
To take most of MetaES, you'll have to learn how it works, otherwise you can just use tools written by others without even being aware of MetaES.
No matter what app you're building and when it is run:
you can benefit from MetaES. It flattens many of your ad-hoc built abstractions, and allows to exchange data between MetaES script and your app.
MetaES is an interpreter, meaning errors and error handling are intristic part of whole project. It's also true for any other interpter following ECMAScript standard.
If you mix your application code with MetaES, your code will reliable to the degree MetaES is.
MetaES was written using JavaScript language, but MetaES follows ECMAScript spec to implement features.
It doesn't implement full spec yet, when trying to use unsupported part, it will throw an error with
information.
If you want to communicate from browser to application running on server, use MetaES messages to communicate. They're JSON based, meaning you can use HTTP (or any other) protocol to transfer data.
It looks a bit like RPC, but it's more like sending code to remote context. It's distributed interpter.
MetaES core is small and simple. If you can't or don't want to choose JavaScript platform for your project, implement MetaES subset yourself and communicate with others using MetaES messages.
Let's get to the working example:
let array = [7, 5, 2, 4, 3, 9];
Object.keys(window)
.slice(0, 5)
.filter(item=>item.indexOf('b')>=0);
const results = [];
for(let item of Object.keys(window).slice(0, 5)){
results.push(item);
}
function bubbleSort(arr){
var len = arr.length;
for (var i = len-1; i>=0; i--){
for(var j = 1; j<=i; j++){
if(arr[j-1]>arr[j]){
var temp = arr[j-1];
arr[j-1] = arr[j];
arr[j] = temp;
}
}
}
return arr;
}
bubbleSort(array); //[2, 3, 4, 5, 7, 9]