JSON and arrays all store data, but there are some differences.
Difference one: The subscript of the JSON is different from the subscript of the array, the subscript of the JSON is the string, and the subscript of the array is the number.
<script>window.onload=function() { var json={name: ' Juce ', Age: ' 23 ' }; alert (json.age); // also equals alert (Json[age]) var arr=[' A ', ' B ', ' C '
Alert (arr[0
</script>
Difference two: JSON has no length, and array has length.
<script> window.onload=function() { var json={name: ' Juce ', Age: ' ~ '}; alert (json.length); // The return is undefined var arr=[' A ', ' B ', ' C '
alert (arr.length); // the return is 3.
</script>
Difference Three: JSON is a data format, and an array is a data type, data types can be added and modified.
<script> window.onload=function() { var json={name: ' Juce ', Age: ' ~ '}; // alert (json.length);//Return to undefined var arr=[' A ', ' B ', ' C ']; // alert (arr.length);//Return is 3 Alert (Arr.push (' C '))// return is 4 }</script>
For an array of methods, mention here:
Array Internal support Array.concat () connection Array array.join () concatenate array elements to build a string Array.Length the size of the array array.pop () deletes and returns the last element of the array Array.push () adds an element to the array array.reverse () reverses the order of the elements in the array array.shift () moves the element to the group Array.slice ( returns a portion of the array array.sort () sorts the array elements Array.splice () inserts, deletes, or replaces elements of the arrays array.tolocalestring () Converts an array to a local string array.tostring () converts an array into a string Array.unshift () inserts an element into the head of the array
We can consolidate it.
This is also my own some superficial understanding, there are any additions or reminders can contact the comments.
I am a rookie, but also gradually learn to understand ...
On the difference between JSON and array