I'm new to programming and I've been told that "Javascript is a Turing complete programming language". What is a "Turing complete" P.language?... I've tried to read some articles in Wiki like Turing complete, or Turing completeness but still couldn't get an asnwer that was enough primal and clear to me...
2 Answers
In layman's terms, you can think of it as a "complete" programming language.
In practice, languages which are not Turing complete have somewhat crippling limitations, such as ones which disallow recursion. It may be fine for a limited-purpose language, but it means that some algorithms cannot be expressed, and some others require tortured workarounds.
In computer science, it is an important principle that complex systems can be "reduced" (proven to be isomorphic, i.e. fundamentally equivalent) to very simple systems which we can reason about. It is fairly easy to reason about what a Turing machine (a very crude theoretical abstraction of a modern computer) can and cannot do; we then know that our conclusions must be true for any system which can be reduced to a Turing machine.
But for your concrete question, this is just a snobbish way to tell the snobs you are one of them, actually.
6 Comments
Before explaining what Turing Complete is, one must explain what a Turing Machine is.
In simple words, (but not-exactly-layman's-terms,) a Turing Machine is a machine that contains mutable state, executes sequences of simple instructions that read and write that state, and can pick different execution paths depending on the state (via conditional branch instructions.)
Very importantly, note that the ability to branch also means the ability to loop, and that different execution paths can perform different mutations on the state.
As simple as the above description is, it has an astonishing emergent characteristic: it is impossible to tell what a non-trivial Turing Machine is going to do via static analysis alone; any analysis aiming to tell how a Turing Machine is going to behave necessarily has to perform an amount of work that is proportional to the amount of work that the machine will do as it runs. (And therefore, if the machine runs forever, then the analysis will never produce an answer, hence The Halting Problem.)
A Turing Complete system is a system that abides by, or can be reduced to, the above description. (So, essentially, it has what it takes to emulate any other Turing Complete system, which is the "isomorphic, i.e. fundamentally equivalent" part that user tripleee wrote in his answer.)
In practical terms, all programming languages are Turing Complete.
Examples of languages that are not Turing Complete are HTML, JSON, CSS, and in general all description languages and markup languages. You can debate as to whether they have mutable state, but what they certainly do not have is instructions reading and writing that state, and branching. If markup languages had these features then they would be Turing Complete, but then we would not be calling them markup languages, we would be calling them programming languages.