node.js
aggiunge una completa interfaccia al
sistema operativo. Il core è in Javascript, e le interfacce
al sistema sono scritte in C o C++ come appropriato.
npm
, il
Node Package Manager.libc
. Un paio di esempi:
data_collector_cgi
data_collector_process
data_collector_status
node
, ed è ottenibile
via npm
!app.js
![]() |
Dan Brown «My mind tells me I will never understand JavaScript. And my heart tells me I am not meant to». /* FACT: Some time in 1557, Michelangelo Moribundi, the renowned, bald-headed alchemist, fashioned a secret code out of bits of asparagus and placed it in a long-forgotten vault ... */ function theDaFibonacciCode(numeratiFettucini) { // Wide awake, the bleary-eyed Langdon watched as two tall, lissome number ones, with // big feet and a type of hat, sidled up to the rounded zero ... var ilInumerati = [0,1,1]; // while theIntegerThatIncrementsOneByOne morphed eerily into a ... three. theIntegerThatIncrementsOneByOne = 3, // Now the silent ratio that could not be uttered had come to make it right. TheBotticelliVector = 1.61803; while (theIntegerThatIncrementsOneByOne < numeratiFettucini) { // Somehow another number one appeared and theIntegerThatIncrementsOneByOne snatched at it gracefully. theIntegerThatIncrementsOneByOne = theIntegerThatIncrementsOneByOne + 1; // The renowned, rounded 16-bit unsigned integer tentatively succumbed to the strange force of // the vector before pushing itself bodily into the hands of the weakly typed array. ilInumerati.push( Math.round(ilInumerati[theIntegerThatIncrementsOneByOne - 2] * TheBotticelliVector) ); } } |
![]() |
William Shakespeare «So foul and fair a language I have not seen». function theSeriesOfFIBONACCI(theSize) { //a CALCKULATION in two acts //employ'ng the humourous logick of JAVA-SCRIPTE //Dramatis Personae var theResult; //an ARRAY to contain THE NUMBERS var theCounter; //a NUMBER, serv'nt to the FOR LOOP //ACT I: in which a ZERO is added for INITIATION //[ENTER: theResult] //Upon the noble list bestow a zero var theResult = [0]; //ACT II: a LOOP in which the final TWO NUMBERS are QUEREED and SUMM'D //[ENTER: theCounter] //Commence at one and venture o'er the numbers for (theCounter = 1; theCounter < theSize; theCounter++) { //By divination set adjoining members theResult[theCounter] = (theResult[theCounter-1] || 1) + theResult[Math.max(0, theCounter-2)]; } //'Tis done, and here's the answer return theResult; //[Exeunt] } |
![]() |
Ernest Hemingway «All my life I've looked at JavaScript as though I were seeing it for the first time». function fibonacci(size) { var first = 0, second = 1, next, count = 2, result = [first, second]; if (size < 2) return "the request was made but it was not good" while (count++ < size) { next = first + second; first = second; second = next; result.push(next); } return result; } |