AlexHฮ๐จโ๐ป๐ง
@bleedingeffigy
Followers
78
Following
2K
Media
57
Statuses
1K
Publishing content covering Web Dev | Fullstack dev | building w/ React & JAMStack
Los Angeles, CA
Joined November 2016
Feeling confident in Javascript? Well, given a string of lowercase letters, would you be able to sum them all up into 1 value? In one line of code? Solution and explanations are below. 1/6๐งต๐
1
0
0
TW: pic of damaged face*** thursday night, i was attacked while going home in brooklyn. i suffered a minor skull fracture, broken teeth, & stitches on my face. im missing work to recover and need help for food & items while at home. pls help if u can, my ven/ca are lanaeatspizza
573
3K
7K
UPDATE: We still donโt know Luceroโs whereabouts. I want to personally say thank you to everyone whoโs reposted, said a prayer, and especially those who have went to higher attempts of finding my friend๐คIโll be posting updates and ways you can #helpfindlucero on my twitter.
0
59
277
And that's it! So in summary, we - split the string into characters - go through each character, converting it into a number - Sum up all the numbers Thanks for sticking around, and stay tuned for the next js lesson.
0
0
0
> .reduce((a, b) => a + b, 0); Lastly, this reduces the list down to a single value. It calls the function we pass on each item in the array, storing the result and calling it again with the next value in the array. Here we are summing up every element in the list.
1
0
0
> .map(c => c.charCodeAt(0) - 96) Map accepts a function and will return the array created from calling the function on every element in the array. Here we are going through our array of characters, and turning each one into a digit, subtracting 96 so a=0. 6/6๐งต๐
1
0
0
So what does 's.split('')' do? Well, split() is a string method, that will divide the string into substrings, and returns them as an array. In this case, '' means we want to divide the string at every character. This gives us the string as an array of characters 5/6๐งต๐
1
0
0
> s > .split('') This is the same as `s.split()` However, JS ignores newlines (line-terminators) when they separate bits of code (except in cases where it auto-inserts ';' like in return) We do this so as we chain multiple functions, it stays easy to read 4/6๐งต๐
1
0
0
> 'const lettersum = s =>' First, we use 'const' to declare a variable (named 'lettersum') whose value shouldn't change later. Then we begin to declare a function using a compact definition called an 'arrow function expression'. 3/6๐งต๐
1
0
0
const lettersum = s => s .split('') .map(c => c.charCodeAt(0) - 96) .reduce((a, b) => a + b, 0); Pretty concise, isn't it? Let's go over this step-by-step 2/6๐งต๐
1
0
0
Investment / Collector DAOs These let people pool capital with the aim of investing in specific assets, ranging from NFTs to sports franchises! This is a fast and simple alternative to venture capital funds. Examples are - PleasrDAO - MetaCartel Ventures - Komerabi 7/16๐งต๐
0
0
0
Ex. Protocol DAO Some examples of Protocol DAOs are - Uniswap - Compound - Aave For example, Uniswap token holders voted on which Layer-2 networks the protocol should be deployed. 6/16๐งต๐
1
0
0
Protocol DAOs From Ethereum came a whole array of new crypto assets. Protocols were made to let people trade these assets. DAOs then emerged to let users have a collective say in the future of the protocol. Voting is done with governance tokens given to users 5/16๐งต๐
1
0
0
What do DAOs do? Present DAOs have a variety of missions, from: - Manage large protocols - Investment - Social Communities - Media - Philanthropic Pursuits Let's take a look at each category now 4/16๐งต๐
1
0
0
What is a DAO? DAOs are software-enabled organizations. The industrial revolution favored the LLC as the tool to organize. DAOs will fulfill this role for Web3 at large. DAOs are leaner than LLCs, attracting talent from all over the world. 3/16๐งต๐
1
0
0
Social networks (and the internet) have made it easy for like-minded individuals to congregate and communicate. The advent of crypto will likewise make it easy to coordinate around financial capital Internet <-> Communication DAOs <-> Capital 2/16๐งต๐
1
0
0
Polkadot is a cryptocurrency network that wants to help weave all the disparate blockchains together. Currently, blockchains operate in silos, separately. But Polkadot promises to fix this by creating an internet of interoperable blockchains. 2/11๐งต๐
0
0
0
Advantages of DAOs? ๐ Transparency - all actions viewable by anyone. ๐ฅ Global power - anyone anywhere can contribute ๐ต Cheaper - tools can be used like Legos, so little needs to be built from scratch. ๐จโ๐ฉโ๐ฆโ๐ฆ Collaborative - giving everyone a voice pools mass knowledge 5/13๐งต๐
0
0
0
How do DAOs work? - Governance mechanism is provided by the smart-contracts - Governance tokens are used by members to vote on actions taken by the DAO - more contributed = stronger vote - Outcome can also be based on participation 4/13๐งต๐
1
0
0
In more detail, a DAO is an organization with control spread out amongst member, vs top-down. They are organized with smart-contracts, and members use 'governance tokens' to vote on decisions made by the DAO. The DAO then executes these decisions, like a machine. 3/13๐งต๐
1
0
0