---
title: "التعيين بالتفكيك (Destructuring) في JS"
description: "أمثلة بسيطة javascript const [a, b, ...c] = [10, 20, 100,200] // a= 10, b=20, c=[100,200] const { first, second } = { first: 1, second: 2 } // first = 1, second = 2"
canonical: https://oozou.com/til/destructuring-assignment-in-js-22
locale: ar
date: 2020-10-13
topic: javascript
---

# التعيين بالتفكيك (Destructuring) في JS

> أمثلة بسيطة javascript const [a, b, ...c] = [10, 20, 100,200] // a= 10, b=20, c=[100,200] const { first, second } = { first: 1, second: 2 } // first = 1, second = 2

Published: 2020-10-13 · Topic: [javascript](https://oozou.com/ar/til-topics/javascript) ([markdown](https://oozou.com/ar/til-topics/javascript.md))

أمثلة بسيطة
*javascript
const [a, b, ...c] = [10, 20, 100,200] // a= 10, b=20, c=[100,200]
const \{ first, second } = \{ first: 1, second: 2 } // first = 1, second = 2*

مثال أعقد
*javascript
const resp = \{
data: \{ message: 'hello', random: 'xxx', test:'hehe' }
}
const \{ data, data: \{ message, ...rest } = resp
// data = \{ message: 'hello' }, message = 'hello'
// rest = \{ random: 'xxx', test: 'hehe' }*

---

Contact OOZOU: hello@oozou.com · +66 2544 0000 · https://oozou.com/ar/contact

More for AI agents: https://oozou.com/llms.txt · every page has a markdown twin at its URL plus ".md"
