우아하게 객체 복제하기 #150
Unanswered
airman5573
asked this question in
JavaScript
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
structuredClone 두둥등장
크롬 98버전 이상에서
structuredClone()
함수를 지원한다!현재 크롬버전이 101임을 감안하면 아직 production에서 쓰기에는 불안전 하지만, 일단 나왔다는것 자체만으로도 감사하다 :D
앞으로 JSON.stringify후 다시 parse를 하거나 직접 clone함수를 구현하는 일은 점점 줄어들것으로 보인다.
아래는 해당 함수를 테스트해본 결과이다.
함수는 안된다
함수는 에러가 뜬다. 왜 DOMException인지는 모르겠지만,, (공식문서 링크)
아무튼 주의해서 사용해야 한다!
Beta Was this translation helpful? Give feedback.
All reactions