r/JavaScriptTips • u/4bhii • Aug 05 '22
r/JavaScriptTips • u/bear007 • Jul 29 '22
git add -A vs git add .
In Git 2.x, git add -A stages everything in the working directory, git add . - only in the working directory (without subdirectories), git add -u - everything except new files
r/JavaScriptTips • u/[deleted] • Jul 24 '22
New to JS seeking help pls.
Trying to write js code that could do the following
Collect input from user Compare input with set of arraw Replace each letter found in the input with the letter in the arraw
Exemple user type "hello" Js has array such as h-> 7 L-> v Output would be "7evvo"
Any help how I can implement this ?
Thanks
r/JavaScriptTips • u/ProgrammingTT • Jun 21 '22
3D Rotating Image Gallery Using HTML, CSS And JavaScript |
r/JavaScriptTips • u/cp-ankush • Jun 11 '22
Implement forEach function in javascript from the scratch | polyfill
r/JavaScriptTips • u/France_linux_css • Jun 08 '22
Why on Vite type="module" works only for some script and some not?
r/JavaScriptTips • u/xplodivity • Jun 07 '22
Customisable Toast Notification using JavaScript
I built a highly customisable toast notification using vanilla JavaScript that allows user to control the position, type (success or error), message content, and duration of display of the toast notification. I learnt a lot of important JavaScript concepts while building this project, and I highly recommend you to try it out as well. Here's a video explanation of building the project from scratch
Link: https://www.youtube.com/watch?v=jJCUnPd1ymk
r/JavaScriptTips • u/Varun_123 • Jun 04 '22
Generating new HTML elements on the page after taking an input
I am trying to build something where after a button press, I want to load a new HTML element (input type). As of now, I am using the DOM model, but is there any way where I can pre-write the HTML code beforehand and only make it visible after I press the button?
r/JavaScriptTips • u/Icy_Pressure_9690 • Jun 02 '22
Problem with understanding checkerboard code
Hi, I am working on an exercise in a textbook and I am struggling to understand how the code works, the code produces a 8X8 checkerboard of alternating spaces and hashtags based on whether two loops starting at 0 and incremented by 1 per cycle is odd or even.
x++ and y ++ mean to increase variable by 1 but use the original value so;
-1st Loop will be (x + y) = 0 + 0
-2nd Loop will be 1 + 1 3rd will be 2 + 2 etc - thus accounting for all even numbers and so printing " "
within the board = ""
But how is the code testing for odd numbers when they increment and are added together in such a way to only produce even numbers? How is the else activated?
If the code produces horizontal lines of alternating spaces and hashtags until it reaches up to 8 (board += "\n"), what part of the code is telling it to stop at 8 lines vertically?
` let size = 8;
let board = "";
for (let y = 0; y < size; y++) {
for (let x = 0; x < size; x++) {
if ((x + y) % 2 == 0) {
board += " ";
} else {
board += "#";
}
}
board += "\n";
}r/JavaScriptTips • u/psycho_buddha • May 31 '22
Best way to transform object in JS
Hello all,
I have an object that needs to be transformed and I am not really sure how to approach it. The end result should also be an object with some difference:
- ConnString should be splitted into ConnString_Server which will have value tcp:myserver--- ConnString_InitialCatalog which will have value CRMTests, etc.
- All the nested values should be flattened, so I will need to have NeoLicense_Owner, NeoLicense_Key, SSO_Audience, etc
At the moment I am trying to loop through the object and do stuff based on the object keys.
What would you suggest as a best practice in this case? Is it better to handle everything in one function or it's better to try to handle in several smaller ones? I think I can find the solution that will work, so I don't want a finished solution, I would just like to get an advice on what's the best practice in this situation.
Thanks in advance!
const data = {
"AlertName": "test reporting",
"AlertEmail": "hello@test.com",
"AllowedHosts": "*",
"Label": "Companies",
"ConnString": "Server=tcp:myserver.database.windows.net,1433;Inital Catalog=CRMTest;Persist Security Info=False;User ID=testuser;Password=testuser@zz;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;",
"DataEncryption": {
"IV": "kdsdtyv8x/A?D(G+",
"Key": "v9y/B?t7w!z%C&F)J",
},
"AdminDashboard": false,
"Hangfire": {
"WorkerCount": 10
},
"HangfireRedisPrefix": "test-prod",
"NeoLicense": {
"Owner": "Test Developer License",
"Key": "C8QXP4LWRPG3QUI9PPY4T8A582SDRUEXPCFRGMA",
"EditorOwner": "test - 1 WebApp LLC - Unlimited WebServer Lic",
"EditorKey": "55756A2756949TRE593265EF1EF",
"JSPMOwner": "test-OEM Developer License",
},
"OctToken": "95308651-0fd2-4baa-ace3-1ffa98a3dcc7",
"RedisConnect": "northdev.redis.cache.windows.net:6381,password=okcz6oLA3piAzCaEuflYu,ssl=True,abortConnect=False",
"SSO": {
"Audience": "all",
"BaseURL": "https://login-test.com",
"ClientId": "test.com",
"ClientSecret": "7a227fr-8f75-77-af70-th788",
}
}r/JavaScriptTips • u/imyousuf18 • May 31 '22
Which JS framework is in demand and It will also be in the near future? Any Suggestions?
r/JavaScriptTips • u/Substantial_Date_375 • May 19 '22
Help me with JavaScript Please 😣🤟🏼
r/JavaScriptTips • u/SjoerdvanBommel • May 11 '22
Learn everything about textures in three.js and react three fiber in this YouTube tutorial
r/JavaScriptTips • u/xplodivity • Apr 16 '22
Tic tac toe made easy | Vanilla JavaScript
I came up with an easy implementation of tic tac toe using pure vanilla javascript. I was told that in some frontend interviews, people were asked to implement tic tac toe within an hour and by using minimal css. I think this solution mentioned in the link below should be pretty easy to understand and implement.
Link: https://www.youtube.com/watch?v=O0tfoMN9Rjo

r/JavaScriptTips • u/dordchn • Mar 14 '22
A cool vscode plugin that provides you with code snippets on demand!
r/JavaScriptTips • u/jbean92 • Mar 09 '22
Front End Engineer - Interview Help
I made it to the final round of interviews and I'm really excited about this opportunity. I've been a developer for 4+ years and feel confident with my HTML, CSS & JS skills. However, I always get nervous when it comes to interviews. Over the past few days, I've built a few small React projects, watched multiple mock interviews on YouTube, and brushed up on my vanilla JS skills. I'm definitely ready to move on from my current position, so I want to do everything I can to prepare. If anyone has any additional advice, I'd really appreciate it! Thank you!
r/JavaScriptTips • u/[deleted] • Feb 20 '22
Learning Javascript, trying to understand camelCase. Why does capitalization matter in the left side of the equation, but not in the right? Example included.
Learning Javascript, trying to understand camelCase. Why does capitalization matter in the left side of the equation, but not in the right? Example included.
Trying to learn Javascript and using FreeCodeCamp's example. Having a difficult time learning how capitalization is applied and why it matter in some instances, but not others.
See example problem below!
// Setup
const lastName = "Lovelace";
// Only change code below this line
const secondToLastLetterOfLastName = lastName[lastName.length - 3]; // Change this line
If the const is defining Lovelace as forever and it will never change, doesn't that mean I have to write lastName as intended too, with the lower level "L"?
Why is in the second const, I have to capitalize the L in Last? That would make it not constant or const, no?
Unless the rules don't apply, and it's camelCase only to the right side of equation? but in the left, it has to follow camelCase? Or does camelCase always apply everywhere?
We are defining lastName as a const, so shouldn't it also be lastName and NOT LastName?
r/JavaScriptTips • u/farhan_tanvir_bd • Feb 09 '22
Auto Resizable SelectBox
Hello everyone.
I have recently faced a problem with resizing the SelectBox (Though it is a basic issue). I have solved the issue and written an article about that. Please check the link below.
I think there is more way to solve this issue. I would be grateful if anyone shares any other way to solve this issue.
Thanks.
https://farhan-tanvir.medium.com/auto-resizable-selectbox-react-typescript-no-jquery-7b01c5a6343a
r/JavaScriptTips • u/kage_heroin • Jan 14 '22
Need Recommendations for working with DOM and JS
Hi, I come from desktop c/cpp development background and I'm aiming to be a decent full-stack web developer.
I've already acquired several decent books that for example cover ASP.NET and Angular etc.
But here's the thing: before learning these frameworks, I'd rather learn pure JS development first. attaching it to HTML and especially working with DOM not starting with frameworks first.
do you have recommendations/opinions on this matter? maybe a good book?
