Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                
              
            
!

CSS

              
                
              
            
!

JS

              
                /*
NJ Namju Lee
Email: nj.namju@gmail.com
Website: www.njstudio.co.kr
Linkedin: https://www.linkedin.com/in/nj-namju-lee-926b3252/

Materials(Eng)
youtube(eng): https://www.youtube.com/channel/UCP4q3a4ogJN1-SbJclJR3Ww
Medium: https://medium.com/@nj.namju

Materials(KR)
youtube(kr): https://www.youtube.com/channel/UC3Z42uoe9C7Et39h5cLK1dw?view_as=subscriber
Daum Brunch: https://brunch.co.kr/@njnamju
  Data & Design Computaional Design : https://brunch.co.kr/@njnamju/64
Naver Blog: https://blog.naver.com/designju
*/

// Reference
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String

// Create an Array
let fruits = ['Apple', 'Banana']
console.log('fruits length', fruits.length) // 2


// Access an Array item using the index position
let first = fruits[0]
console.log('first', first)

let last = fruits[fruits.length - 1]
console.log('last', last)

first = 'Fineapple';
console.log(fruits)


// Modify an iteam in an Array
fruits[0] = 'Fineapple';
console.log(fruits)


// Add an item to the end of an Array
fruits.push('Orange')
console.log(fruits)


// Remove an item from the end of an Array
let last = fruits.pop() // remove Orange (from the end)
console.log(fruits) // ["Fineapple", "Banana"]


// Add an item to the beginning of an Array
let newLength = fruits.unshift('Strawberry') // add to the front
console.log(fruits) // ["Strawberry", "Fineapple", "Banana"]


// Remove an item from the beginning of an Array
let indexNumber = fruits.indexOf('Fineapple')
console.log(indexNumber);


// Remove an item by index position
let removedItem = fruits.splice(indexNumber, 1) // this is how to remove an item         
console.log(fruits);


// Check an iteam
console.log('includes apple?',fruits.includes('banana'));
console.log('includes apple?',fruits.includes('Banana'));


// Merge arrays
let array1 = ['a', 'b', 'c'];
let array2 = ['d', 'e', 'f'];
let array3 = array1.concat(array2);
console.log(array3);


// Loop an array
// javascript function
for(let index = 0 ; index < array3.length; ++index) {
	  console.log('by for loop :', array3[index], index);
}
array3.forEach(function(item, index) {
  console.log('by foreach :',item, index)
})
// Arrow function
array3.forEach((item, index) => {
  console.log('by arrow function :', item, index)
})
              
            
!
999px

Console