1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-20 15:38:02 +00:00

Compare commits

...

3 Commits

Author SHA1 Message Date
nick-w-nick
a4959d3791 Merge 295fe153ad into 4b6833c437 2024-10-01 20:55:33 -04:00
jbranchaud
4b6833c437 Add Install Java On Mac With Brew as a Java TIL 2024-10-01 19:21:14 -05:00
nick-w-nick
295fe153ad added mention of ES6 compatibility
Hello, I've added a small blockquote below the description to indicate that this method of accessing an indefinite number of function arguments has been superseded by the use of the spread operator via rest parameters for ES6+ compatibility.
2022-01-06 11:39:04 -05:00
3 changed files with 54 additions and 1 deletions

View File

@@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186).
_1448 TILs and counting..._
_1449 TILs and counting..._
---
@@ -430,6 +430,10 @@ _1448 TILs and counting..._
- [Search Tweets By Author](internet/search-tweets-by-author.md)
- [Show All Pivotal Stories With Blockers](internet/show-all-pivotal-stories-with-blockers.md)
### Java
- [Install Java On Mac With Brew](java/install-java-on-mac-with-brew.md)
### JavaScript
- [Accessing Arguments To A Function](javascript/accessing-arguments-to-a-function.md)

View File

@@ -0,0 +1,47 @@
# Install Java On Mac With Brew
If you don't already have Java installed on your Mac, you can install it with
homebrew.
```bash
$ brew install java
```
This will take a bit to run and when all is complete, you'll go to run
something like a version check and see this:
```bash
$ java -version
The operation couldnt be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.
```
This is because [OpenJDK](https://openjdk.org/) the open-source implementation
of the Java Development Kit (Java platform) does not get fully set up by
homebrew.
You'll need to symlink `openjdk` and the exact command with correct paths can
be found from running the following:
```bash
$ brew info openjdk
...
For the system Java wrappers to find this JDK, symlink it with
sudo ln -sfn /usr/local/opt/openjdk/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk
...
```
The paths may look different for you, so copy the exact command and run that.
Once the symlink is set, check the version again.
```bash
$ java -version
openjdk version "23" 2024-09-17
OpenJDK Runtime Environment Homebrew (build 23)
OpenJDK 64-Bit Server VM Homebrew (build 23, mixed mode, sharing)
```
[source](https://stackoverflow.com/a/65601197/535590)

View File

@@ -5,6 +5,8 @@ an array-like object with all of the arguments to the function. Even if not
all of the arguments are referenced in the function signature, they can
still be accessed via the `arguments` object.
> For ES6+ compatibility, the `spread` operator used via [rest parameters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters) is preferred over the `arugments` object when accessing an abritrary number of function arguments.
```javascript
function argTest(one) {
console.log(one);