From 86978491e59e2be17f6cc175dbc0390a206c3e62 Mon Sep 17 00:00:00 2001 From: Trust Onyemachi <85189857+code-with-onye@users.noreply.github.com> Date: Fri, 10 Jun 2022 02:45:39 -0700 Subject: [PATCH] converting arrays to string --- 05_Day_Arrays/05_day_arrays.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/05_Day_Arrays/05_day_arrays.md b/05_Day_Arrays/05_day_arrays.md index 0dae635..e6696f1 100644 --- a/05_Day_Arrays/05_day_arrays.md +++ b/05_Day_Arrays/05_day_arrays.md @@ -42,6 +42,7 @@ - [Add an element from the beginning](#add-an-element-from-the-beginning) - [Reversing array order](#reversing-array-order) - [Sorting elements in array](#sorting-elements-in-array) + - [Converting Arrays to Strings](#converting-arrays-to-string) - [Array of arrays](#array-of-arrays) - [💻 Exercise](#-exercise) - [Exercise: Level 1](#exercise-level-1) @@ -653,6 +654,16 @@ console.log(arrayOfArray[0]) // [1, 2, 3] console.log(fullStack[1]) // ["Node", "Express", "MongoDB"] ``` +### Converting Arrays to String + +The join() method allows you to concatenate all elements of an array and returns a new string: +```js +const frontEnd = ['HTML', 'CSS', 'JS']; +const btnClass = cssClasses.join(' '); + +console.log(btnClass); //HTML CSS JS +``` + 🌕 You are diligent and you have already achieved quite a lot. You have just completed day 5 challenges and you are 5 steps a head in to your way to greatness. Now do some exercises for your brain and for your muscle. ## 💻 Exercise