javascript - Why A and B are equal after sort()? -


  फ़ंक्शन रैंडऑर्ड () (रिटर्न (मठ। (मठ.रेंडम ()) - 0.5)} ए = [0,1,2,3,4,5,6,7] var बी = एएसोर्ट (रैंडऑर्ड) console.log ('ए =', ए) console.log ('बी =', बी)   

आउटपुट:

  a = [3, 4, 0, 1, 6, 2, 5, 7] b = [3, 4, 0, 1, 6, 2, 5, 7]   

मुझे आशा है कि a मूल सरणी होने के लिए और b सॉर्ट किए जाने के लिए । लेकिन वे दोनों बराबर (सॉर्ट किए गए) हैं, क्यों?

क्योंकि Array.sort () विधि। < / P>

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -