Javascript -> JavaScript (English) (#35183)
* Javascript -> JavaScript (English) * Update technical documentation page for required change * Update use-class-syntax-to-define-a-constructor-function.english.md * Update left-factorials.md
This commit is contained in:
committed by
The Coding Aviator
parent
fed6ffb606
commit
e84ae45008
@@ -86,7 +86,7 @@ The first expression gets evaluated if it's false, and the second gets evaluated
|
||||
|
||||
**Note:** There is no `when/else`. `when` _only_ executes if the condition is true.
|
||||
|
||||
`cond` allows you to combine many conditions into a single expression. It takes a sequence of logical expression and expression pairs and evaluate each logical expression in order. When it finds a logical expression that evaluates to `true`, it evaluates the second expression of the pair. After this, no other expressions are evaluated. This behavior is like short-circuit logic in Javascript.
|
||||
`cond` allows you to combine many conditions into a single expression. It takes a sequence of logical expression and expression pairs and evaluate each logical expression in order. When it finds a logical expression that evaluates to `true`, it evaluates the second expression of the pair. After this, no other expressions are evaluated. This behavior is like short-circuit logic in JavaScript.
|
||||
|
||||
(cond (= 0 1) "I'm paired with a false expression and I don't evalute.."
|
||||
(= 1 1) "I'm the first expression paired with a true expression!"
|
||||
|
@@ -1,7 +1,7 @@
|
||||
---
|
||||
title: Clojure Hashmaps
|
||||
---
|
||||
A hashmap is a collection that maps keys to values. They have various names in other languages; Python refers to them as dictionaries, and Javascript's objects essentially work like hashmaps.
|
||||
A hashmap is a collection that maps keys to values. They have various names in other languages; Python refers to them as dictionaries, and JavaScript's objects essentially work like hashmaps.
|
||||
|
||||
A hashmap can, like many collections, be constructed in two ways. There is the constructor function:
|
||||
|
||||
@@ -92,4 +92,4 @@ A hashmap is useful when you want to give names to your variables. If you're eve
|
||||
They are also useful if you want to associate two different values with each other. Take, for example, a ROT13 cipher: you could associate `\A` with `\N`, `\B` with `\M`, etc. (This would be long and boring to write in most languages, but Clojure has some functions that can generate it for you and make it _fun!_)
|
||||
|
||||
| [ Previous](//forum.freecodecamp.com/t/clojure-vectors/18421) | [ Home ](//forum.freecodecamp.com/t/clojure-resources/18422) | Next  |
|
||||
| [Vectors](//forum.freecodecamp.com/t/clojure-vectors/18421) | [Table of Contents](//forum.freecodecamp.com/t/clojure-resources/18422) | To Be Added |
|
||||
| [Vectors](//forum.freecodecamp.com/t/clojure-vectors/18421) | [Table of Contents](//forum.freecodecamp.com/t/clojure-resources/18422) | To Be Added |
|
||||
|
@@ -1,7 +1,7 @@
|
||||
---
|
||||
title: Clojure Vectors
|
||||
---
|
||||
A vector is perhaps the most simple type of collection in Clojure. You can think of it like an array in Javascript. Let's define a simple vector:
|
||||
A vector is perhaps the most simple type of collection in Clojure. You can think of it like an array in JavaScript. Let's define a simple vector:
|
||||
|
||||
(def a-vector [1 2 3 4 5])
|
||||
;; Alternatively, use the vector function:
|
||||
@@ -60,4 +60,4 @@ Non-vector data structures can be converted into vectors using the `vec` functio
|
||||
A vector should be used in almost all cases if you need a collection, because they have the shortest random-access times, which makes it easy to retrieve items from a vector. Note that vectors are ordered. If order doesn't matter, it may be better to use a set. Also note that vectors are designed for appending items; if you need to prepend items, you might want to use a list.
|
||||
|
||||
| [ Previous](//forum.freecodecamp.com/t/clojure-lists-they-are-everything/18417) | [ Home ](//forum.freecodecamp.com/t/clojure-resources/18422) | [Next ](//forum.freecodecamp.com/t/clojure-hashmaps/18414)|
|
||||
| [Lists](//forum.freecodecamp.com/t/clojure-lists-they-are-everything/18417) | [Table of Contents](//forum.freecodecamp.com/t/clojure-resources/18422) | [Hashmaps](//forum.freecodecamp.com/t/clojure-hashmaps/18414)|
|
||||
| [Lists](//forum.freecodecamp.com/t/clojure-lists-they-are-everything/18417) | [Table of Contents](//forum.freecodecamp.com/t/clojure-resources/18422) | [Hashmaps](//forum.freecodecamp.com/t/clojure-hashmaps/18414)|
|
||||
|
Reference in New Issue
Block a user