Most voted "scope" questions
28 questions
Sort by count of
-
5
votes2
answers449
viewsQuestions about block scope in Javascript
The doubts are as follows: What is the difference between block scope and function scope in Javascript? The idea of block scope arose in Ecmascript 6 with let and const?…
-
4
votes1
answer75
viewsWhen to use local classes in Java?
I learned that it is possible to declare classes within blocks as methods, for example: void exemplo() { class teste { } } But when local classes come in handy?…
-
3
votes2
answers224
viewsIs it possible to force a method to be called only by a specific one?
I have a father method that calls a son method, I wish the son method could only be called exclusively by the father method, it would be possible? Example: public void MetodoPai(){ //codigo…
-
3
votes2
answers78
viewsIs it correct and or indicated to merge in a 5.x Laravel project with the components developed in Vuejs 2 all within the same directory?
It is known that the integration between Laravel and Vue is good, however it would be indicated to use the Vue components within a Modular project? each time the application grows will be more tied…
-
3
votes1
answer36
viewsThis parameter outside of expected inside an anonymous function
I made a code to train handling Arrays and Javascript. This is part of the code: function Playlist (nome ='Playlist'){ const musicas = []; function addMusicas(...novasMusicas){…
-
3
votes1
answer85
viewsHow to access, within a function, a global variable that has the same identifier as the variable within the function?
Let’s assume I have the following Javascript code: let variavel = 22 function funcao(){ let variavel = 333 console.log(variavel) } funcao() //333 We realized that, since the variable declared within…
-
2
votes1
answer96
viewsScope of PHP variable
So, I’ve been banging my head for a while now with a basic question of scope, but I couldn’t figure out why. In the function below, I am trying to access a position of the object that is running at…
-
2
votes1
answer59
viewsWhat happens when using namespace within a namespace?
What happens when I use the directive using namespace x within a namespace? For example: namespace x { int k = 1; } namespace y { using namespace x; } Now when I use the namespace y can access…
-
2
votes2
answers286
viewsDifference between global and local scope
I recently came across the concept of global and local scope and, I’m having great difficulty in understanding them in terms of conceptualization. What would be scope in its definition, and global…
-
2
votes2
answers92
viewsDoes pushing inside a for loop not increment a declared Let in its scope?
I was reading the series You Don’t Know JS which says the following about let declared in for loops: There’s a special behavior defined for let declarations used in the head of a for-loop. This…
-
2
votes1
answer63
viewsInside setInterval, "this" does not point to the function that called it
The context in which this Arrow was created was directly in the method setInterval, however the this points to the idade inside the object Pessoa, why? The this in Arrow is based on the context in…
-
1
votes1
answer1474
viewsAngularjs take the $Scope and concatenate into a URL
app js. angular.module("FipeApp", []); angular.module("FipeApp").controller("FipeAppCtrl", function($scope, $http) { $scope.app = "FIPE APP"; $scope.tipos = [{ nome: "Carros", id: "carros" }, {…
-
1
votes1
answer1245
viewsProblems with ng-required and ng-disable
I have a web application, where a person can enter their skills but if there’s a bug that allows them to enter blank skills, then I’m trying to use the ng-required in the input and the ng-disable on…
javascript angularjs web-application angularjs-scope scopeasked 8 years, 9 months ago Gustavo Moreira 45 -
1
votes1
answer100
viewsC++ Reach Problem
I’m a beginner in C++ programming and came across a problem when trying to execute my code on Atom, using the gpp-Compiler package and Mingw: 'Function' was not declared in this Scope (l.8). I…
-
1
votes0
answers23
viewsScope problem in namespace and class, C++
I tried to create a complex class in a C++ namespace per exercise, but when I try to define some methods of my class, the compiler returns error. My code: Complex. h: #ifndef COMPLEX_N_H #define…
-
0
votes0
answers472
views$Scope does not visually update the data I fill with Javascript
I’m filling in mine $scope via Javascript using the following code: myApp.controller('gruposController', ['$scope', '$http', '$window', 'usuariosFactory', '$timeout', function ($scope, $http,…
-
0
votes1
answer149
viewsScope of service-worker?
I am working on a PWA and would like to know if the scope or directory where the service-worker file is located can interfere, such as in push notifications. A file that is inside /statics/sw.js…
-
0
votes1
answer177
viewsDoubt Scope of Javascript Variables
in the code below I try to use the variables lastLatitude and lastLongitude outside the local scope. I need them in initial. I’ve tried many things, someone can help me understand? <script>…
-
0
votes1
answer158
viewsHow to create Scope in Laravel 5.4 with linked tables via belongsToMany
The structure of the table is this: pessoa id - integer nome - string unidade id - integer nome - string pessoa_unidade pessoa_id - integer unidade_id - integer I have the models: class Pessoa…
-
0
votes1
answer167
viewsVariable and scope beyond file . cpp C++
Is there a possibility of a file . cpp "seeing" a variable declared in in another file . cpp? Example: in the main.cpp file there is a global variable int myVar. You can access it in another file,…
-
0
votes1
answer53
viewsDetect if it’s inside a callback?
Basically I want a function to behave differently if it is inside a callback. See the example: import Test from './test ;' Test.say('Olá!'); // Deve imprimir: "Olá!" Test.group(() => {…
-
0
votes1
answer57
viewsWrong output in C
I’m doing an activity and the result is giving some values that I don’t assign anywhere in the code. int main(){ int numeroDePessoas = 0, tarefa = 0; scanf("%d %d", &tarefa,…
-
0
votes0
answers21
viewsQuestions about closure in Javascript
Doubt: Hello, everyone. I’m making some progress in my Javascript studies, however, I have found it difficult to understand what it is closure. I found some websites and books that define closure is…
-
0
votes0
answers24
viewsmicrosoft-Graph getting only Scope user.read
Hello! If anyone can help. I’m trying to get emails from some of our organization’s 365 accounts to integrate with a CRM application. The program is in PHP and I’m trying to access in microsoft…
-
0
votes0
answers34
viewsCalling a variable or method within a static method
Hi, I’m using Laravel on this app. I have a static method called get() (Which was created in a Class I did not gain access to) and inside it I need to access an external variable called $routeTo. I…
-
-1
votes1
answer38
viewsDoubt of structure using Global Scopes in Laravel
A doubt of structure. Scenario: I have 3 users: administrator, stores, customers. I have a product model and I want to define a global Cope in it so that when stores access the product listing the…
-
-3
votes2
answers34
viewsphp variable scope resolution
I’m not able to understand how the scope of variables works in php, I try to use a variable, declared outside a function, inside this and it is null $DSN = $dsn; echo $DSN; function…
-
-3
votes1
answer37
viewsWhen I run on html the classification always shows Undefined, but when I run on the console it brings the answer of the _class variable can anyone help me?
<script type="text/javascript"> //função que calculao IMC do paciente. function CalcImc(peso,altura){ var imc = p/(a*a); return imc; } //Entrada de dados e…