<commit_before>---
layout: post
title: '[JavaScript] 交互两个变量的值'
date: 2019-10-10
author: mdgsf
comments: true
categories: Web
tags: [js, javascript]
description: ''
published: true #default true
---

```
a = 1;
b = 2;

b = [a, (a = b)][0];

console.log(a, b);
```
<commit_msg>modify js swap two value<commit_after>---
layout: post
title: '[JavaScript] 交换两个变量的值'
date: 2019-10-10
author: mdgsf
comments: true
categories: Web
tags: [js, javascript]
description: ''
published: true #default true
---

```
a = 1;
b = 2;

b = [a, (a = b)][0];

// or use destructuring
// [b] = [a, (a = b)];

console.log(a, b);
```

{'fraction_non_alphanumeric': 0.20361247947454844, 'fraction_numerical': 0.0361247947454844, 'mean_word_length': 3.88, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6260431', 'n_tokens_mistral': 280, 'n_tokens_neox': 256, 'n_words': 75}