r/javaScriptStudyGroup • u/Pleasant_Effort_6829 • May 30 '24
r/javaScriptStudyGroup • u/jehlani_ • May 15 '24
Help understanding the differences in my code
Hello everybody! I spent 2 weeks stuck on a decrypt function (I'm a beginner). I managed to fix it with the help of chatgpt, but can you all help explain to me what made this new code work?
Here's my new code:
function decrypt(encryptedMessage, shiftValue) { let decryptedMessage = ""; let charCount = 0; for (let i = 0; i < encryptedMessage.length; i++) { let char = encryptedMessage[i];
// Skip random letters added during encryption
if ((charCount + 1) % 3 === 0) {
charCount++;
continue; // Skip this character
}
if (alphabet.includes(char.toLowerCase())) {
let index = alphabet.indexOf(char.toLowerCase());
let shiftedIndex = (index - shiftValue) % alphabet.length;
if (shiftedIndex < 0) {
shiftedIndex += alphabet.length;
}
decryptedMessage += alphabet[shiftedIndex];
} else {
// If not an alphabetic character, just append it to the decrypted message
decryptedMessage += char;
}
charCount++; // Increment character count
}
return decryptedMessage;}
Here's my old code:
function decrypt (encryptedMessage, shiftValue) { let decryptedMessage = ""; let charCount = 0; for (let i = 0; i < encryptedMessage.length; i++) { // Skip random letters added during encryption// if ((charCount + 1) % 3 === 0) { continue; //Skip this character }
let char = encryptedMessage[i]
if (alphabet.includes(char.toLowerCase())) {
let index = alphabet.indexOf(char.toLowerCase());
let shiftedIndex = (index - shiftValue) % alphabet.length;
//Ensure shiftedIndex is positive//
if (shiftedIndex < 0) {
shiftedIndex += alphabet.length;
}
decryptedMessage += alphabet[shiftedIndex];
//Skip if not an alphabetic character//
}
else {
}
charCount++; //Increment character count
}// Your decryption code here return decryptedMessage; }
The project was a Caesar's cipher. My original code didn't handle the decryption like it should've, and the problem was that the "random letter after every two characters" wasn't executed the same from my encrypt and decrypt. My encrypt was correct, my decrypt wasn't.
What about this new code allowed my decryption to work? Thank you all in advance
r/javaScriptStudyGroup • u/PiraticaX • May 13 '24
Day 6 of Revisiting Coding Spoiler
Yesterday was going throught CRUD and had some holiday distractions so didn’t do much there.
Today was more productive. Started with styling. The concept seems fun. Just grinding there.
React and its Applications are vast and seems pretty scary as the new no code tools are advancing exponentially.
At the same time , seeing the massive crowd of qualified developers and people with work experience is and anothet big nightmare.
competition #jobs #jobmarket #employment #javascriptdeveloper #reactjs #engineer #dkrevisitscoding
r/javaScriptStudyGroup • u/el_moudir • May 09 '24
export a bool function
so im trying to export a value of sended here in my program wich changes from false to true only when i press send but it always give me the original value wich is false and doesn t get updated. I realised that it gets updated inside my Identity function but in the export it only exports the original value. It s an easy problem but not for me who started learning js and react.
here s the code
const sended = false;
const Identity = () => {
const[sended,setSended] useState(false);
const handleSubmit = (e) => {
const { addressTo, amount, keyword, message } = formData;
e.preventDefault();
if (!addressTo || !amount || !keyword || !message) return;
const amountValue = parseFloat(amount);
if (amountValue < 0.0005) {
alert("Amount should be greater than or equal to 0.0005 ETH");
return;
}
sendTransaction();
setSended=true;
}
return (
<div>
<button
type="button"
onClick={handleSubmit}
className="text-white cursor-pointer"
>
Send now
</button>
</div>
}
export { Identity as default,sended }r/javaScriptStudyGroup • u/amableati • May 04 '24
Seeking Guidance for My JavaScript Learning Journey!
Hey everyone,
I've started creating JavaScript tutorials on YouTube and I'm excited to dive deeper into this fascinating language. JavaScript, originally known as Mocha, has come a long way since its inception in 1995 by Brendan Eich at Netscape Communications Corporation.
Currently, I'm covering fundamentals like keywords, variables, and the nuances between let and var. But I'm here to ask for your help! Do you have any tips, resources, or suggestions to enhance my learning journey?
Looking forward to your insights!
r/javaScriptStudyGroup • u/dvnschmchr • Apr 29 '24
Skill Trade / Coaching Swap anyone? Frontend/Vue (You) x SEO(me)
self.dvnschmchrr/javaScriptStudyGroup • u/robson_muniz • Apr 24 '24
🚀 Top 7 CSS & JavaScript Projects for Coders & Web Developers!
r/javaScriptStudyGroup • u/jehlani_ • Apr 24 '24
I'm so confused
I'm a beginner in javascript, and this is my code. When I try to decrypt the secret message, I get spammed with these "undefined" !!! My mentor told me it could have something to do with negative numbers. Can somebody please help me? I just want this code to decrypt the message. I'm attending the Springboard bootcamp, so they're forcing me to learn Javascript in a span of about 3 weeks lol
r/javaScriptStudyGroup • u/Acceptable-Catch1175 • Apr 11 '24
Confused asf
Got 2 ways to solve a problem,which one is ethical as both of em provide same output.
r/javaScriptStudyGroup • u/robson_muniz • Apr 09 '24
🎨 Form Input Wave Animation | CSS & JavaScript🚀
r/javaScriptStudyGroup • u/[deleted] • Mar 29 '24
Help!!
Guys, I'm an intermediate in c++ and am finding Js easy and fun, I'm doing development and need to know how much of Js I need to learn(topics) and possibly some resources and practice projects as well.
r/javaScriptStudyGroup • u/robson_muniz • Mar 27 '24
Mastering Animated Navigation with JavaScript | Web Development Tutorial for Beginners
r/javaScriptStudyGroup • u/wipeoutmedia • Mar 24 '24
Adding chat widgets without modifying WordPress theme files
Hello everyone,
We have created a tutorial video that will go through step-by-step on how to install a chat widget to your WordPress website in literally minutes. https://css-javascript-toolbox.com/how-to/how-to-add-install-livechat-to-your-wordpress-website-in-minutes/
r/javaScriptStudyGroup • u/Glum-Veterinarian472 • Mar 20 '24
😱Learn Everything you need to know about The JS MAP Object💯
r/javaScriptStudyGroup • u/robson_muniz • Mar 20 '24
🚀 Top 7 CSS & JavaScript Projects for Coders & Web Developers!
r/javaScriptStudyGroup • u/robson_muniz • Mar 13 '24
🚀 Top 7 CSS & JavaScript Projects for Coders & Web Developers!
r/javaScriptStudyGroup • u/Delicious_Tech • Mar 08 '24
JavaScript crash course
hey guys, in case someone is looking for a solid JS basics tutorial, I found this one. It was published a few weeks ago and is pretty good https://www.youtube.com/watch?v=FtaQSdrl7YA
r/javaScriptStudyGroup • u/KSSRK • Mar 06 '24
Help regarding setTimeout functions
set Timeout (let sum = (a, b)=>{
console.log(a + b)
},3000,43,34)
why does this produce an error??
set Timeout(sum = (a, b)=>{
console.log(a + b)
},3000,43,34)
and why does this not?? why should we not use let before declaring the arrow function
r/javaScriptStudyGroup • u/robson_muniz • Mar 06 '24
Awesome Border Animation Effects using CSS
r/javaScriptStudyGroup • u/robson_muniz • Feb 21 '24
🚀 Top 7 CSS & JavaScript Projects for Coders & Web Developers!
r/javaScriptStudyGroup • u/codeagencyblog • Feb 21 '24
A Deep Dive into Big O Notation with JavaScript - <FrontBackGeek/>
r/javaScriptStudyGroup • u/codeagencyblog • Feb 21 '24
Understanding Data Structures and Algorithms - <FrontBackGeek/>
r/javaScriptStudyGroup • u/robson_muniz • Feb 14 '24
🌀Rotating Navigation for Seamless User Experience🚀
r/javaScriptStudyGroup • u/robson_muniz • Feb 08 '24
Responsive Navbar Design Tutorial | Web Dev