<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:///TR/xhtml1/DTD/">
<html xmlns="http:///1999/xhtml">
<head>
<title>null,undefined,Address to talk about the memory possession of strings</title>
<style type="text/css">
body{font-size:12px;}
pre{padding:5px;border:solid 2px #dfdfdf;color:#fff; background-color:#666;}
</style>
</head>
<body>
<pre>
<strong>Summary:</strong>
//One need to note is that although null is Object type, it is very special and is stored in the stack. You can understand it as a special form of Object.
//In other object-oriented languages, strings are usually stored in the heap heap, but in js this is stored in the stack stack
//After this, I suddenly thought of a question. The difference between statement and definition. I thought about it and felt that it was the same thing, just two statements. At this moment, I suddenly thought that when a variable is declared,
//Is it in the stack? Whether it occupies memory (of course, all code will have code segments, but memory is used, but I am not talking about this), I mean whether undefined variables exist in the stack.
//Think for a while I think there is, the reason is that the undefined type has only one value undefined. When the declared variable is not initialized, of course the default value is the literal of undefined.
//Tell me about null, it should have existed in the heap, but the js heap ECMAscript implementation is wrong, and it is now accepted by the standard. It becomes a placeholder for an Object
</pre>
<script language="javascript" type="text/javascript">
alert(NaN == NaN);//false
alert(undefined === undefined);//true
alert(undefined == null);//true, the reason is derived from null when undefined.
alert(typeof null);
alert(undefined === null); //false
// Through the above example, you can write a function to determine whether it is undefined as follows
var isUndefined = function (param) {
return param === undefined;
};
//One need to note is that although null is Object type, it is very special and is stored in the stack. You can understand it as a special form of Object.
//In other object-oriented languages, strings are usually stored in the heap heap, but in js this is stored in the stack stack
</script>
</body>
</html>